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

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

Issue 2981693002: Start copying resolution/inference data from front end to analyzer ASTs. (Closed)
Patch Set: Address code review comments. Created 3 years, 5 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 765b02a64a8241af5dad2ce22fbc8c3af9cf0587..85fe8318bb0c59d99454c6d06a3ba7beec50f528 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -62,8 +62,10 @@ class AstBuilder extends ScopeListener {
/// bodies.
final bool isFullAst;
+ final bool generateKernel;
+
AstBuilder(this.errorReporter, this.library, this.member, this.elementStore,
- Scope scope, this.isFullAst,
+ Scope scope, this.isFullAst, this.generateKernel,
[Uri uri])
: uri = uri ?? library.fileUri,
super(scope);
@@ -298,12 +300,16 @@ class AstBuilder extends ScopeListener {
} else {
bodyStatement = (body as BlockFunctionBody).block;
}
- var kernel = toKernel(bodyStatement, elementStore, library.library, scope);
- if (member is ProcedureBuilder) {
- ProcedureBuilder builder = member;
- builder.body = kernel;
- } else {
- unexpected("procedure", "${member.runtimeType}", member.charOffset, uri);
+ if (generateKernel) {
+ var kernel =
+ toKernel(bodyStatement, elementStore, library.library, scope);
+ if (member is ProcedureBuilder) {
+ ProcedureBuilder builder = member;
+ builder.body = kernel;
+ } else {
+ unexpected(
+ "procedure", "${member.runtimeType}", member.charOffset, uri);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698