Add QoL `Variable#reference(scope)` method

This commit is contained in:
Sijawusz Pur Rahnama 2023-12-28 04:01:05 +01:00
parent 444b07c179
commit ce3f2b7e4b
2 changed files with 6 additions and 3 deletions

View File

@ -72,6 +72,11 @@ module Ameba::AST
end
end
# :ditto:
def reference(scope : Scope)
reference(node, scope)
end
# Reference variable's assignments.
#
# ```

View File

@ -178,9 +178,7 @@ module Ameba::AST
when scope.type_definition? && accessor_macro?(node) then return false
when scope.def? && special_node?(node)
scope.arguments.each do |arg|
variable = arg.variable
ref = variable.reference(variable.node, scope)
ref = arg.variable.reference(scope)
ref.explicit = false
end
end