Skip to content
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

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

hendrikvanantwerpen
Copy link
Collaborator

This updates the tree-sitter-javascript dependency to a release version, instead of a SHA dependency, making it releasable.

@hendrikvanantwerpen hendrikvanantwerpen requested a review from a team as a code owner March 8, 2024 16:30
@hendrikvanantwerpen hendrikvanantwerpen self-assigned this Mar 8, 2024
Comment on lines -2307 to +2310
(function)
(function_expression)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏻

Comment on lines +2436 to +2439
[
(primary_expression/identifier)@variable
(member_expression . (identifier)@variable)
] {
Copy link
Collaborator Author

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_expressions 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...

Comment on lines -3869 to -3899
(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
}
Copy link
Collaborator Author

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.

Comment on lines -3830 to -3867
(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
}
Copy link
Collaborator Author

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.

@hendrikvanantwerpen hendrikvanantwerpen merged commit be64a09 into main Mar 8, 2024
8 checks passed
@hendrikvanantwerpen hendrikvanantwerpen deleted the update-tree-sitter-javascript branch March 8, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants