-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix wrong parsing when a function call with a (one or more) variable … #327
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -105,6 +105,7 @@ module.exports = grammar({ | |||||
|
||||||
[$.tuple_element, $.declaration_expression], | ||||||
[$.tuple_element, $.variable_declarator], | ||||||
[$.tuple_element, $.using_variable_declarator], | ||||||
|
||||||
[$.constant_pattern, $._name], | ||||||
[$.constant_pattern, $._name, $._lvalue_expression], | ||||||
|
@@ -1160,11 +1161,22 @@ module.exports = grammar({ | |||||
|
||||||
unsafe_statement: $ => seq('unsafe', $.block), | ||||||
|
||||||
using_variable_declaration: $ => seq( | ||||||
field('type', $._type), | ||||||
commaSep1($.using_variable_declarator) | ||||||
), | ||||||
|
||||||
using_variable_declarator: $ => seq( | ||||||
field('name', $.identifier), | ||||||
optional($.bracketed_argument_list), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea, unfortunately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @damieng Can you think of a case when we'd need the |
||||||
optional($.equals_value_clause) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it really optional to have an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I don't know. |
||||||
), | ||||||
|
||||||
using_statement: $ => seq( | ||||||
optional('await'), | ||||||
'using', | ||||||
'(', | ||||||
choice($.variable_declaration, $._expression), | ||||||
choice($.using_variable_declaration, $._expression), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
')', | ||||||
field('body', $._statement) | ||||||
), | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,6 +226,7 @@ | |
|
||
;; Variable declarations | ||
(variable_declarator (identifier) @variable) | ||
(using_variable_declarator (identifier) @variable) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we wouldn't need this if the alias was added. |
||
(for_each_statement left: (identifier) @variable) | ||
(catch_declaration (_) (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.
I think
using_variable_declaration
could be reused infixed_statement
too, so I'd rename it tovariable_declaration_no_tuple
, or something similar.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'd really prefer we keep the names aligned with Roslyn. Apart from the compatibility it really helps understanding how the grammar rules change given the ongoing evolution of C#.
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.
So what name should I use?