-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
NodePattern: Use param === node
to match params.
#31
Conversation
726a5c9
to
3080ea1
Compare
3080ea1
to
0e6ed2c
Compare
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.
Awesome, thank you so much!
@@ -374,6 +374,41 @@ def_node_matcher :initializing_with_user?, <<~PATTERN | |||
PATTERN | |||
---- | |||
|
|||
== `%` for arguments |
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.
👍 I was looking for this section today.
#804 (comment) Support introduced in rubocop/rubocop-ast#31 Presumably this will land in RuboCop 1.0 or 1.0.1 worst case.
I'll check about accepting |
#804 (comment) Support introduced in rubocop/rubocop-ast#31 Presumably this will land in RuboCop 1.0 or 1.0.1 worst case.
#804 (comment) Support introduced in rubocop/rubocop-ast#31 Presumably this will land in RuboCop 1.0 or 1.0.1 worst case.
#804 (comment) Support introduced in rubocop/rubocop-ast#31 Presumably this will land in RuboCop 1.0 or 1.0.1 worst case.
#804 (comment) Support introduced in rubocop/rubocop-ast#31 Presumably this will land in RuboCop 1.0 or 1.0.1 worst case.
Used to be
node == param
.For most classes,
===
is the same as==
, and==
is symmetric, so this has no impact, except forRegexp
,Class
,Proc
,Set
,Range
, none of which can exist in the AST.This opens many cool patterns though:
(hash <(pair (_ %1) $_)>...)
called with a regexp to match a symbol/string key(send _ %1 ...)
called withSet
of possible method names to match.etc.
Thanks to @pirj for bringing this to my attention