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

Unified Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 2985703002: new handleInvalidTopLevelDeclaration event in fasta parser (Closed)
Patch Set: address comments 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/lib/src/fasta/ast_builder.dart
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 294bd16e7d44982187d96fdb71509f60936039b7..1f44ed8252bd770d869b6492cd0a143be3d6da2b 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1123,6 +1123,16 @@ class AstBuilder extends ScopeListener {
debugEvent("TopLevelDeclaration");
}
+ @override
+ void handleInvalidTopLevelDeclaration(Token endToken) {
+ debugEvent("InvalidTopLevelDeclaration");
+ pop(); // metadata star
+ // TODO(danrubel): consider creating a AST node
+ // representing the invalid declaration to better support code completion,
+ // quick fixes, etc, rather than discarding the metadata and token
+ push(NullValue.InvalidTopLevelDeclaration);
+ }
+
@override
void beginCompilationUnit(Token token) {
push(token);
@@ -1145,6 +1155,10 @@ class AstBuilder extends ScopeListener {
directives.add(node);
} else if (node is CompilationUnitMember) {
declarations.add(node);
+ } else if (node == NullValue.InvalidTopLevelDeclaration) {
+ // TODO(danrubel): consider creating a AST node
+ // representing the invalid declaration to better support code completion,
ahe 2017/08/16 13:22:45 Long line! P0!!! ;-)
danrubel 2017/08/16 13:34:29 Fixed. :-)
+ // quick fixes, etc, rather than discarding the metadata and token
} else {
unhandled(
"${node.runtimeType}", "compilation unit", node?.offset, uri);

Powered by Google App Engine
This is Rietveld 408576698