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

Unified Diff: pkg/compiler/lib/src/kernel/kernel_visitor.dart

Issue 2682553002: Fix lingering switch statement test failures. (Closed)
Patch Set: associateNode Created 3 years, 10 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 | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/kernel_visitor.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel_visitor.dart b/pkg/compiler/lib/src/kernel/kernel_visitor.dart
index 13544295ed919f797916a645838a3cf9185598cd..8ba98d0bea7888a493cd276aa5633eabf2f41ff5 100644
--- a/pkg/compiler/lib/src/kernel/kernel_visitor.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_visitor.dart
@@ -387,13 +387,13 @@ class KernelVisitor extends Object
}
ir.LabeledStatement getBreakTarget(JumpTarget target) {
- return breakTargets.putIfAbsent(
- target, () => new ir.LabeledStatement(null));
+ return breakTargets.putIfAbsent(target,
+ () => associateNode(new ir.LabeledStatement(null), target.statement));
}
ir.LabeledStatement getContinueTarget(JumpTarget target) {
- return continueTargets.putIfAbsent(
- target, () => new ir.LabeledStatement(null));
+ return continueTargets.putIfAbsent(target,
+ () => associateNode(new ir.LabeledStatement(null), target.statement));
}
ir.SwitchCase getContinueSwitchTarget(JumpTarget target) {
@@ -591,7 +591,7 @@ class KernelVisitor extends Object
// One VariableDefinitions statement node (dart2js AST) may generate
// multiple statements in Kernel IR so we sometimes fall through here.
}
- return new ir.Block(statements);
+ return associateNode(new ir.Block(statements), node);
}
@override
@@ -789,8 +789,10 @@ class KernelVisitor extends Object
new ir.ForStatement(variables, condition, updates, body), node);
ir.Statement result = buildBreakTarget(forStatement, node, jumpTarget);
if (initializer != null) {
- result = new ir.Block(
- <ir.Statement>[new ir.ExpressionStatement(initializer), result]);
+ result = associateNode(
+ new ir.Block(
+ <ir.Statement>[new ir.ExpressionStatement(initializer), result]),
+ node.initializer);
}
return result;
}
@@ -826,6 +828,7 @@ class KernelVisitor extends Object
// its visit method (so it can build break targets correctly).
? statement.accept(this)
: buildStatementInBlock(statement);
+ associateNode(result, statement);
// A [LabeledStatement] isn't the actual jump target, instead, [statement]
// is the target. This allows uniform handling of break and continue in
@@ -999,7 +1002,9 @@ class KernelVisitor extends Object
}
// We ignore the node's statements here, they're generated below in
// [visitSwitchStatement] once we've set up all the jump targets.
- return new ir.SwitchCase(expressions, null, isDefault: node.isDefaultCase);
+ return associateNode(
+ new ir.SwitchCase(expressions, null, isDefault: node.isDefaultCase),
+ node);
}
/// Returns true if [node] would let execution reach the next node (aka
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698