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

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

Issue 2738693003: Fix for parsing empty compilation units with Fasta. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
index 4b56ebc125fd952e1a5ae7a8f1b2e28679b5c6bc..175ce815a37f718341692f394f63bfc4beff0463 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/ast_builder.dart
@@ -852,14 +852,17 @@ class AstBuilder extends ScopeListener {
var directives = <Directive>[];
var declarations = <CompilationUnitMember>[];
analyzer.Token endToken = null; // TODO(paulberry)
- for (AstNode node in popList(count)) {
- if (node is Directive) {
- directives.add(node);
- } else if (node is CompilationUnitMember) {
- declarations.add(node);
- } else {
- internalError(
- 'Unrecognized compilation unit member: ${node.runtimeType}');
+ List<Object> elements = popList(count);
+ if (elements != null) {
+ for (AstNode node in elements) {
+ if (node is Directive) {
+ directives.add(node);
+ } else if (node is CompilationUnitMember) {
+ declarations.add(node);
+ } else {
+ internalError(
+ 'Unrecognized compilation unit member: ${node.runtimeType}');
+ }
}
}
push(ast.compilationUnit(
« no previous file with comments | « pkg/analyzer/test/generated/parser_fasta_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698