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

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

Issue 3001993002: improve fasta export directive recovery (Closed)
Patch Set: rebase 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 70c5dcff314b298aac6f5992d9631fda5e417b9b..589b785bc1a09b9aafdca860fc4f7ee221d3bcae 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -2647,9 +2647,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() {
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | pkg/compiler/lib/src/parser/element_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698