File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
front_end/lib/src/fasta/parser Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
2525import 'test_support.dart';
2626
2727main() {
28+ // The fasta parser has a parallel set of tests in parser_fasta_test.dart
29+ if (Parser.useFasta) return;
30+
2831 defineReflectiveSuite(() {
2932 defineReflectiveTests(ClassMemberParserTest);
3033 defineReflectiveTests(ComplexParserTest);
Original file line number Diff line number Diff line change @@ -8760,10 +8760,15 @@ D d;''');
87608760 serializeLibraryText ('@a(-b=""c' );
87618761 expect (unlinkedUnits, hasLength (1 ));
87628762 List <UnlinkedVariable > variables = unlinkedUnits[0 ].variables;
8763- expect (variables, hasLength (1 ));
8764- List <UnlinkedExpr > annotations = variables[0 ].annotations;
8765- expect (annotations, hasLength (1 ));
8766- expect (annotations[0 ].isValidConst, isFalse);
8763+ if (Parser .useFasta) {
8764+ // Fasta recovers by appending `)` after `c`
8765+ expect (variables, isEmpty);
8766+ } else {
8767+ expect (variables, hasLength (1 ));
8768+ List <UnlinkedExpr > annotations = variables[0 ].annotations;
8769+ expect (annotations, hasLength (1 ));
8770+ expect (annotations[0 ].isValidConst, isFalse);
8771+ }
87678772 }
87688773
87698774 test_metadata_invalid_instanceCreation_argument_super () {
Original file line number Diff line number Diff line change @@ -1189,6 +1189,12 @@ class Parser {
11891189 // Scanner has already reported a missing `)` error,
11901190 // but placed the `)` in the wrong location, so move it.
11911191 token = rewriter.moveSynthetic (token, begin.endGroup);
1192+ } else if (next.kind == IDENTIFIER_TOKEN &&
1193+ next.next.kind == IDENTIFIER_TOKEN ) {
1194+ // Looks like a missing comma
1195+ Token comma = new SyntheticToken (TokenType .COMMA , next.charOffset);
1196+ token = rewriter.insertTokenAfter (token, comma).next;
1197+ continue ;
11921198 } else {
11931199 reportRecoverableError (
11941200 next, fasta.templateExpectedButGot.withArguments (')' ));
You can’t perform that action at this time.
0 commit comments