-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VarNode
class for lvar
, ivar
, cvar
and gvar
node types
#204
base: master
Are you sure you want to change the base?
Conversation
@@ -19,6 +19,7 @@ def namespace | |||
def name | |||
node_parts[1] | |||
end | |||
alias short_name name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CasgnNode
and Const
should have a symmetrical interface so that they can be compared (eg. in Lint/SelfAssignment
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, but maybe the best would be to simply move all the implementation of Const
to a module and include this here too?
@marcandre CI is failing on https://github.com/rubocop/rubocop/blob/345be1d50c6f44b8ae1a880f490d5faa1f368945/spec/rubocop/cop/metrics/utils/abc_size_calculator_spec.rb#L345-L360 because of Now Any ideas? |
731e408
to
6655719
Compare
Sorry, that's my code 😅 . |
Is there a way we can update
Do you mean something like: if defined?(RuboCop::AST::VarNode) ? RuboCop::AST::VarNode.new(...) : s(...)
I don't think we can do this because I think the issue is this I've had a little trouble tracing what's happening in that class though so I may be offbase. |
Adds node classes for variables, to have symmetry with the assignment nodes. eg. a
lvasgn
andlvar
for the same variable should have the same value for the#name
method.