Chromium Code Reviews| 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); |