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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.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
Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 4c9fe6e180344c7ae1d1143b44dd6ec8a89a191f..596178e0f6e2e2eb093cc1a8d591a5b3caf3662f 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -715,18 +715,20 @@ class KernelJumpTarget extends JumpTarget {
/// Pointer to the actual executable statements that a jump target refers to.
/// If this jump target was not initially constructed with a LabeledStatement,
- /// this value is identical to originalStatement.
- // TODO(efortuna): In an ideal world the Node should be some common
- // interface we create for both ir.Statements and ir.SwitchCase (the
- // ContinueSwitchStatement's target is a SwitchCase) rather than general
- // Node. Talking to Asger about this.
+ /// this value is identical to originalStatement. This Node is actually of
+ /// type either ir.Statement or ir.SwitchCase.
ir.Node targetStatement;
/// The original statement used to construct this jump target.
/// If this jump target was not initially constructed with a LabeledStatement,
- /// this value is identical to targetStatement.
+ /// this value is identical to targetStatement. This Node is actually of
+ /// type either ir.Statement or ir.SwitchCase.
ir.Node originalStatement;
+ /// Used to provide unique numbers to labels that would otherwise be duplicate
+ /// if one JumpTarget is inside another.
+ int nestingLevel;
+
@override
bool isBreakTarget = false;
@@ -756,6 +758,13 @@ class KernelJumpTarget extends JumpTarget {
new LabelDefinitionX(null, 'L${index++}', this)..setBreakTarget());
isBreakTarget = true;
}
+ var originalNode = adapter.getNode(originalStatement);
+ var originalTarget = adapter.elements.getTargetDefinition(originalNode);
+ if (originalTarget != null) {
+ nestingLevel = originalTarget.nestingLevel;
+ } else {
+ nestingLevel = 0;
+ }
if (makeContinueLabel) {
labels.add(
@@ -789,14 +798,6 @@ class KernelJumpTarget extends JumpTarget {
@override
String get name => 'target';
- // TODO(efortuna): In the original version, this nesting level is specified at
- // jump target construction time, by the resolver. Because these are
- // instantiated later, we don't have that information. When we move fully over
- // to the kernel model, we can pass the nesting level in KernelJumpTarget's
- // constructor.
- @override
- int get nestingLevel => 0;
-
@override
ast.Node get statement => null;
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | pkg/compiler/lib/src/ssa/switch_continue_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698