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

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

Issue 2914373002: Restore invariant that stack is empty in parseFunctionBody. (Closed)
Patch Set: Created 3 years, 7 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 5422a77712e42eaceadc75cdd8ba2e3d40235a01..b1364cb8bf8aa022ddc9736993b1654ea3936287 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -58,8 +58,12 @@ class AstBuilder extends ScopeListener {
/// being parsed.
String className;
+ /// If true, this is building a full AST. Otherwise, only create method
+ /// bodies.
+ final bool isFullAst;
+
AstBuilder(this.errorReporter, this.library, this.member, this.elementStore,
- Scope scope,
+ Scope scope, this.isFullAst,
[Uri uri])
: uri = uri ?? library.fileUri,
super(scope);
@@ -403,6 +407,7 @@ class AstBuilder extends ScopeListener {
void handleNoInitializers() {
debugEvent("NoInitializers");
+ if (!isFullAst) return;
push(NullValue.ConstructorInitializerSeparator);
push(NullValue.ConstructorInitializers);
}
@@ -410,6 +415,7 @@ class AstBuilder extends ScopeListener {
void endInitializers(int count, Token beginToken, Token endToken) {
debugEvent("Initializers");
List<Object> initializerObjects = popList(count) ?? const [];
+ if (!isFullAst) return;
push(beginToken);
« no previous file with comments | « pkg/analyzer/lib/src/fasta/analyzer_diet_listener.dart ('k') | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698