From 65ab317a3bb716cc9973fd5ea3e8e01254b9a61d Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Wed, 27 Dec 2023 19:28:56 +0100 Subject: [PATCH] Merge `delegate` calls --- src/ameba/ast/scope.cr | 5 ++--- src/ameba/ast/variabling/argument.cr | 5 ++--- src/ameba/ast/variabling/assignment.cr | 5 ++--- src/ameba/ast/variabling/ivariable.cr | 6 ++---- src/ameba/ast/variabling/type_dec_variable.cr | 5 ++--- src/ameba/ast/variabling/variable.cr | 6 ++---- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/ameba/ast/scope.cr b/src/ameba/ast/scope.cr index 97b71483..3e0b4573 100644 --- a/src/ameba/ast/scope.cr +++ b/src/ameba/ast/scope.cr @@ -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 diff --git a/src/ameba/ast/variabling/argument.cr b/src/ameba/ast/variabling/argument.cr index 59b54661..d080e9a1 100644 --- a/src/ameba/ast/variabling/argument.cr +++ b/src/ameba/ast/variabling/argument.cr @@ -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. # diff --git a/src/ameba/ast/variabling/assignment.cr b/src/ameba/ast/variabling/assignment.cr index 7168f5cb..ece19b80 100644 --- a/src/ameba/ast/variabling/assignment.cr +++ b/src/ameba/ast/variabling/assignment.cr @@ -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. # diff --git a/src/ameba/ast/variabling/ivariable.cr b/src/ameba/ast/variabling/ivariable.cr index 836ad345..db6f3bd3 100644 --- a/src/ameba/ast/variabling/ivariable.cr +++ b/src/ameba/ast/variabling/ivariable.cr @@ -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 diff --git a/src/ameba/ast/variabling/type_dec_variable.cr b/src/ameba/ast/variabling/type_dec_variable.cr index 3376b37f..74cc3fbb 100644 --- a/src/ameba/ast/variabling/type_dec_variable.cr +++ b/src/ameba/ast/variabling/type_dec_variable.cr @@ -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 diff --git a/src/ameba/ast/variabling/variable.cr b/src/ameba/ast/variabling/variable.cr index c2eee962..615b588e 100644 --- a/src/ameba/ast/variabling/variable.cr +++ b/src/ameba/ast/variabling/variable.cr @@ -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). #