tree-sitter / tree-sitter-javascript

Javascript grammar for tree-sitter
MIT License
314 stars 108 forks source link

Align nested_identifier -> member_expression alias field names #267

Closed helixbass closed 3 months ago

helixbass commented 8 months ago

This PR adds field names to the existing nested_identifier rule (which gets used for dotted JSX element names eg <Foo.Bar />) so that when it gets aliased to $.member_expression it has the same field names as a "normal" member_expression (ie object and property)

This seems desirable to me so that one can treat it as an "invariant" that when you see a member_expression node it definitely has object and property fields

Checklist:

amaanq commented 8 months ago

I'm going to assume you're using the node version of tree-sitter to generate - can you use the Rust crate on master? (notice the small changes made to parser.h, that's bad)

helixbass commented 8 months ago

Ok re-ran tree-sitter generate using a locally built version of tree-sitter cli/ with its current master, I see the changes to parser.h went away

amaanq commented 3 months ago

Hi @helixbass, I cherry picked your changes onto #291, thank you!