Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 3001993002: improve fasta export directive recovery (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 6eb0bfcf606957c62c5723a373c97397b4b9e7e6..21c9dbc246c6ab3eb7e4cdd2543f4fcf041b42ee 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -2645,9 +2645,32 @@ class Foo {
CompilationUnit unit = parseCompilationUnit(
"export '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
ExportDirective directive = unit.directives[0] as ExportDirective;
+ expect(directive.uri, isNotNull);
+ expect(directive.uri.stringValue, '');
+ expect(directive.uri.beginToken.isSynthetic, false);
+ expect(directive.uri.isSynthetic, false);
+ Token semicolon = directive.semicolon;
+ expect(semicolon, isNotNull);
+ expect(semicolon.isSynthetic, isTrue);
+ ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
+ expect(clazz.name.name, 'A');
+ }
+
+ void test_expectedToken_uriAndSemicolonMissingAfterExport() {
+ CompilationUnit unit = parseCompilationUnit("export class A {}", [
+ ParserErrorCode.EXPECTED_STRING_LITERAL,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ]);
+ ExportDirective directive = unit.directives[0] as ExportDirective;
+ expect(directive.uri, isNotNull);
+ expect(directive.uri.stringValue, '');
+ expect(directive.uri.beginToken.isSynthetic, true);
+ expect(directive.uri.isSynthetic, true);
Token semicolon = directive.semicolon;
expect(semicolon, isNotNull);
expect(semicolon.isSynthetic, isTrue);
+ ClassDeclaration clazz = unit.declarations[0] as ClassDeclaration;
+ expect(clazz.name.name, 'A');
}
void test_expectedToken_semicolonMissingAfterExpression() {

Powered by Google App Engine
This is Rietveld 408576698