Merge delegate calls

This commit is contained in:
Sijawusz Pur Rahnama 2023-12-27 19:28:56 +01:00
parent 452a7a867e
commit 65ab317a3b
6 changed files with 12 additions and 20 deletions

View file

@ -34,9 +34,8 @@ module Ameba::AST
# The actual AST node that represents a current scope. # The actual AST node that represents a current scope.
getter node : Crystal::ASTNode getter node : Crystal::ASTNode
delegate to_s, to: node delegate location, end_location, to_s,
delegate location, to: node to: @node
delegate end_location, to: node
def_equals_and_hash node, location def_equals_and_hash node, location

View file

@ -19,9 +19,8 @@ module Ameba::AST
# Variable of this argument (may be the same node) # Variable of this argument (may be the same node)
getter variable : Variable getter variable : Variable
delegate location, to: @node delegate location, end_location, to_s,
delegate end_location, to: @node to: @node
delegate to_s, to: @node
# Creates a new argument. # Creates a new argument.
# #

View file

@ -19,9 +19,8 @@ module Ameba::AST
# A scope assignment belongs to # A scope assignment belongs to
getter scope : Scope getter scope : Scope
delegate to_s, to: @node delegate location, end_location, to_s,
delegate location, to: @node to: @node
delegate end_location, to: @node
# Creates a new assignment. # Creates a new assignment.
# #

View file

@ -2,10 +2,8 @@ module Ameba::AST
class InstanceVariable class InstanceVariable
getter node : Crystal::InstanceVar getter node : Crystal::InstanceVar
delegate location, to: @node delegate location, end_location, name, to_s,
delegate end_location, to: @node to: @node
delegate name, to: @node
delegate to_s, to: @node
def initialize(@node) def initialize(@node)
end end

View file

@ -2,9 +2,8 @@ module Ameba::AST
class TypeDecVariable class TypeDecVariable
getter node : Crystal::TypeDeclaration getter node : Crystal::TypeDeclaration
delegate location, to: @node delegate location, end_location, to_s,
delegate end_location, to: @node to: @node
delegate to_s, to: @node
def initialize(@node) def initialize(@node)
end end

View file

@ -17,10 +17,8 @@ module Ameba::AST
# Node of the first assignment which can be available before any reference. # Node of the first assignment which can be available before any reference.
getter assign_before_reference : Crystal::ASTNode? getter assign_before_reference : Crystal::ASTNode?
delegate location, to: @node delegate location, end_location, name, to_s,
delegate end_location, to: @node to: @node
delegate name, to: @node
delegate to_s, to: @node
# Creates a new variable(in the scope). # Creates a new variable(in the scope).
# #