8aa48712be
Previously, if a pattern variable declaration appeared outside of a function or method, the parser would get very confused. Now it recognizes the situation, issues a comprehensible error message, and replaces the pattern with a synthetic identifier token so that the analyzer AST is somewhat sensible. Fixes #51322. Bug: https://github.com/dart-lang/sdk/issues/51322 Change-Id: Ica5f060cb483a39c4e50942d639939b1fab40bea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293087 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
12 lines
300 B
Plaintext
12 lines
300 B
Plaintext
NOTICE: Stream was rewritten by parser!
|
|
|
|
class C {
|
|
var *synthetic* = (0, 1);
|
|
}
|
|
|
|
|
|
class[KeywordToken] C[StringToken] {[BeginToken]
|
|
var[KeywordToken] [SyntheticStringToken] =[SimpleToken] ([BeginToken]0[StringToken],[SimpleToken] 1[StringToken])[SimpleToken];[SimpleToken]
|
|
}[SimpleToken]
|
|
[SimpleToken]
|