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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2616933003: Ensure we're looking at the correct resolved AST when initializing fields in constructors. (Closed)
Patch Set: . Created 3 years, 11 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/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 3fd863fdd15b8911e4fe340a1482554a6a1daba3..1ba5ab1e764e0b2e9efd1de9968a1a29bf331788 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -23,7 +23,6 @@ import '../js/js.dart' as js;
import '../js_backend/backend.dart' show JavaScriptBackend;
import '../kernel/kernel.dart';
import '../native/native.dart' as native;
-import '../resolution/tree_elements.dart';
import '../tree/dartstring.dart';
import '../tree/nodes.dart' show Node, BreakStatement;
import '../types/masks.dart';
@@ -114,9 +113,6 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
@override
JavaScriptBackend get backend => compiler.backend;
- @override
- TreeElements get elements => resolvedAst.elements;
-
SourceInformationBuilder sourceInformationBuilder;
KernelAstAdapter astAdapter;
LoopHandler<ir.Node> loopHandler;
@@ -297,8 +293,12 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
if (field.initializer == null) {
fieldValues[field] = graph.addConstantNull(closedWorld);
} else {
+ // Gotta update the resolvedAst when we're looking at field values
+ // outside the constructor.
+ astAdapter.pushResolvedAst(field);
field.initializer.accept(this);
fieldValues[field] = pop();
+ astAdapter.popResolvedAstStack();
}
}
@@ -385,7 +385,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
return builtArguments;
}
- /// Inlines the given super [constructor]'s initializers by collecting it's
+ /// Inlines the given super [constructor]'s initializers by collecting its
/// field values and building its constructor initializers. We visit super
/// constructors all the way up to the [Object] constructor.
void _buildInlinedInitializers(ir.Constructor constructor,
@@ -792,8 +792,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
HLoopInformation loopInfo = current.loopInformation;
HBasicBlock loopEntryBlock = current;
HBasicBlock bodyEntryBlock = current;
- JumpTarget target =
- elements.getTargetDefinition(astAdapter.getNode(doStatement));
+ JumpTarget target = astAdapter.elements
+ .getTargetDefinition(astAdapter.getNode(doStatement));
bool hasContinues = target != null && target.isContinueTarget;
if (hasContinues) {
// Add extra block to hang labels on.
@@ -905,8 +905,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
// Since the body of the loop has a break, we attach a synthesized label
// to the body.
SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
- JumpTarget target =
- elements.getTargetDefinition(astAdapter.getNode(doStatement));
+ JumpTarget target = astAdapter.elements
+ .getTargetDefinition(astAdapter.getNode(doStatement));
LabelDefinition label = target.addLabel(null, 'loop');
label.setBreakTarget();
HLabeledBlockInformation info = new HLabeledBlockInformation(

Powered by Google App Engine
This is Rietveld 408576698