Skip to content

Commit

Permalink
Merge delegate calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Jan 1, 2024
1 parent 452a7a8 commit 65ab317
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/ameba/ast/scope.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ module Ameba::AST
# The actual AST node that represents a current scope.
getter node : Crystal::ASTNode

delegate to_s, to: node
delegate location, to: node
delegate end_location, to: node
delegate location, end_location, to_s,
to: @node

def_equals_and_hash node, location

Expand Down
5 changes: 2 additions & 3 deletions src/ameba/ast/variabling/argument.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ module Ameba::AST
# Variable of this argument (may be the same node)
getter variable : Variable

delegate location, to: @node
delegate end_location, to: @node
delegate to_s, to: @node
delegate location, end_location, to_s,
to: @node

# Creates a new argument.
#
Expand Down
5 changes: 2 additions & 3 deletions src/ameba/ast/variabling/assignment.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ module Ameba::AST
# A scope assignment belongs to
getter scope : Scope

delegate to_s, to: @node
delegate location, to: @node
delegate end_location, to: @node
delegate location, end_location, to_s,
to: @node

# Creates a new assignment.
#
Expand Down
6 changes: 2 additions & 4 deletions src/ameba/ast/variabling/ivariable.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ module Ameba::AST
class InstanceVariable
getter node : Crystal::InstanceVar

delegate location, to: @node
delegate end_location, to: @node
delegate name, to: @node
delegate to_s, to: @node
delegate location, end_location, name, to_s,
to: @node

def initialize(@node)
end
Expand Down
5 changes: 2 additions & 3 deletions src/ameba/ast/variabling/type_dec_variable.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ module Ameba::AST
class TypeDecVariable
getter node : Crystal::TypeDeclaration

delegate location, to: @node
delegate end_location, to: @node
delegate to_s, to: @node
delegate location, end_location, to_s,
to: @node

def initialize(@node)
end
Expand Down
6 changes: 2 additions & 4 deletions src/ameba/ast/variabling/variable.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ module Ameba::AST
# Node of the first assignment which can be available before any reference.
getter assign_before_reference : Crystal::ASTNode?

delegate location, to: @node
delegate end_location, to: @node
delegate name, to: @node
delegate to_s, to: @node
delegate location, end_location, name, to_s,
to: @node

# Creates a new variable(in the scope).
#
Expand Down

0 comments on commit 65ab317

Please sign in to comment.