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

Unified Diff: pkg/compiler/lib/src/js_model/locals.dart

Issue 3007783004: Handle switch continue (Closed)
Patch Set: Updated cf. comment Created 3 years, 4 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/ssa/jump_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_model/locals.dart
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 53bb0151c27ab7a1cf44e24c8c2cb6864db6e562..47e10b7654b20260279eb8f27881e35200f607ac 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -88,15 +88,15 @@ class KernelToLocalsMapImpl implements KernelToLocalsMap {
@override
JumpTarget getJumpTargetForContinueSwitch(ir.ContinueSwitchStatement node) {
_ensureJumpMap(node.target);
- throw new UnimplementedError(
- 'KernelToLocalsMapImpl.getJumpTargetForContinueSwitch');
+ JumpTarget target = _jumpTargetMap[node];
+ assert(target != null, failedAt(currentMember, 'No target for $node.'));
+ return target;
}
@override
JumpTarget getJumpTargetForSwitchCase(ir.SwitchCase node) {
_ensureJumpMap(node);
- throw new UnimplementedError(
- 'KernelToLocalsMapImpl.getJumpTargetForSwitchCase');
+ return _jumpTargetMap[node];
}
@override
@@ -183,7 +183,9 @@ class JumpVisitor extends ir.Visitor {
JJumpTarget _getJumpTarget(ir.TreeNode node) {
return jumpTargetMap.putIfAbsent(node, () {
- return new JJumpTarget(member, jumpIndex++);
+ return new JJumpTarget(member, jumpIndex++,
+ isSwitch: node is ir.SwitchStatement,
+ isSwitchCase: node is ir.SwitchCase);
});
}
@@ -275,6 +277,16 @@ class JumpVisitor extends ir.Visitor {
jumpTargetMap[node] = target;
super.visitBreakStatement(node);
}
+
+ @override
+ visitContinueSwitchStatement(ir.ContinueSwitchStatement node) {
+ JJumpTarget target = _getJumpTarget(node.target);
+ target.isContinueTarget = true;
+ jumpTargetMap[node] = target;
+ JLabelDefinition label = _getOrCreateLabel(target, node.target);
+ label.isContinueTarget = true;
+ super.visitContinueSwitchStatement(node);
+ }
}
class JJumpTarget extends JumpTarget<ir.Node> {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/jump_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698