-
Notifications
You must be signed in to change notification settings - Fork 128
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
Update tree-sitter-javascript dependency to release version #414
Conversation
(function) | ||
(function_expression) |
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.
🤷🏻
[ | ||
(primary_expression/identifier)@variable | ||
(member_expression . (identifier)@variable) | ||
] { |
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.
This bit benefits from the ability to add edges multiple times. The grammar now renames nested_identifier
(used in jsx constructs) to member_expression
(which also exists as a production in expression
), but the identifiers in the (originally nested_identifier
) are not expressions, and thus not processed by the primary_expression/identifier
rule. So we have a situation where member_expression
s may or may not be proper expressions with proper expressions as subnodes, and it's impossible to write a query isolating the no-actually-expressions identifiers, so there's a bit over overlap in the matches for the two cases here. Sigh...
(jsx_fragment (_)*@children)@jsx_fragment { | ||
node @jsx_fragment.before_scope | ||
node @jsx_fragment.after_scope | ||
node @jsx_fragment.value | ||
|
||
if (is-empty @children) { | ||
edge @jsx_fragment.after_scope -> @jsx_fragment.before_scope | ||
} | ||
} | ||
|
||
(jsx_fragment | ||
. | ||
(_)@first_child)@jsx_fragment | ||
{ | ||
edge @first_child.before_scope -> @jsx_fragment.before_scope | ||
} | ||
|
||
(jsx_fragment | ||
(_)@left_child | ||
. | ||
(_)@right_child) | ||
{ | ||
edge @right_child.before_scope -> @left_child.after_scope | ||
} | ||
|
||
(jsx_fragment | ||
(_)@last_child | ||
.)@jsx_fragment | ||
{ | ||
edge @jsx_fragment.after_scope -> @last_child.after_scope | ||
} |
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.
This production was removed from the grammar.
(nested_identifier)@nested_identifier { | ||
node @nested_identifier.before_scope | ||
node @nested_identifier.after_scope | ||
node @nested_identifier.value | ||
|
||
edge @nested_identifier.after_scope -> @nested_identifier.before_scope | ||
} | ||
|
||
(nested_identifier | ||
(identifier)@first_part | ||
(identifier)@second_part)@nested_identifier | ||
{ | ||
node guard_member | ||
|
||
attr (@first_part.value) node_reference = @first_part | ||
attr (@second_part.value) node_reference = @second_part | ||
attr (guard_member) symbol_reference = "GUARD:MEMBER" | ||
|
||
edge @first_part.value -> @nested_identifier.before_scope | ||
edge guard_member -> @first_part.value | ||
edge @second_part.value -> guard_member | ||
edge @nested_identifier.value -> @second_part.value | ||
} | ||
|
||
(nested_identifier | ||
(nested_identifier)@first_part | ||
(identifier)@second_part)@nested_identifier | ||
{ | ||
node guard_member | ||
|
||
attr (@second_part.value) node_reference = @second_part | ||
attr (guard_member) symbol_reference = "GUARD:MEMBER" | ||
|
||
edge @first_part.before_scope -> @nested_identifier.before_scope | ||
edge guard_member -> @first_part.value | ||
edge @second_part.value -> guard_member | ||
edge @nested_identifier.value -> @second_part.value | ||
} |
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.
These separate rules are obsolete now that nested_identifier
is renamed to member_expression.
This updates the
tree-sitter-javascript
dependency to a release version, instead of a SHA dependency, making it releasable.