Skip to content

Avoid tokenizing []= as a single token whereit cannot possibly be valid. #4566

@RohitSaily

Description

@RohitSaily
void main() {if([]==[]);} // ERROR at first `[]`

Results in parsing errors from both dart runand analysis when editing in VS Code. Parenthesizing works - for example

void main() {if(([])==[]);} // OK

Seems to have something to do with operators:

if([]+[]==[]); // ERROR at `[]+[]`

I would expect it to work without parenthesizing, just like a member access or invocation

void main()
{	if([].reversed=={}); // OK
}

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhanced-syntaxUsed with proposals about improvements of the Dart grammar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions