diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart index bfb4157967c..dc832dfcb9b 100644 --- a/pkg/analyzer/test/generated/parser_test.dart +++ b/pkg/analyzer/test/generated/parser_test.dart @@ -15596,8 +15596,9 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase { void test_parseCompilationUnit_builtIn_asFunctionName() { for (Keyword keyword in Keyword.values) { - if (keyword.isBuiltIn) { + if (keyword.isBuiltIn || keyword.isPseudo) { String lexeme = keyword.lexeme; + if (lexeme == 'Function' && !usingFastaParser) continue; parseCompilationUnit('$lexeme(x) => 0;'); parseCompilationUnit('class C {$lexeme(x) => 0;}'); } @@ -15607,7 +15608,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase { void test_parseCompilationUnit_builtIn_asFunctionName_withTypeParameter() { if (usingFastaParser) { for (Keyword keyword in Keyword.values) { - if (keyword.isBuiltIn) { + if (keyword.isBuiltIn || keyword.isPseudo) { String lexeme = keyword.lexeme; parseCompilationUnit('$lexeme(x) => 0;'); parseCompilationUnit('class C {$lexeme(x) => 0;}'); @@ -15618,7 +15619,7 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase { void test_parseCompilationUnit_builtIn_asGetter() { for (Keyword keyword in Keyword.values) { - if (keyword.isBuiltIn) { + if (keyword.isBuiltIn || keyword.isPseudo) { String lexeme = keyword.lexeme; parseCompilationUnit('get $lexeme => 0;'); parseCompilationUnit('class C {get $lexeme => 0;}'); @@ -15701,6 +15702,16 @@ abstract class TopLevelParserTestMixin implements AbstractParserTestCase { expect(unit.declarations, hasLength(1)); } + void test_parseCompilationUnit_pseudo_prefixed() { + for (Keyword keyword in Keyword.values) { + if (keyword.isPseudo) { + String lexeme = keyword.lexeme; + parseCompilationUnit('M.$lexeme f;'); + parseCompilationUnit('class C {M.$lexeme f;}'); + } + } + } + void test_parseCompilationUnit_script() { createParser('#! /bin/dart'); CompilationUnit unit = parser.parseCompilationUnit2(); diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart index edf7e196141..2c46b7b2781 100644 --- a/pkg/front_end/lib/src/fasta/parser/parser.dart +++ b/pkg/front_end/lib/src/fasta/parser/parser.dart @@ -1420,7 +1420,7 @@ class Parser { // Return the newly inserted synthetic token // as the end of the type reference. return token.next; - } else if (identical(value, '<') || identical(value, 'Function')) { + } else if (identical(value, '<')) { // Found a type reference, but missing an identifier after the period. rewriteAndRecover( token,