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

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

Issue 2965763002: Support break in switch and break/continue in do statements (Closed)
Patch Set: Updated cf. comments. Created 3 years, 6 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 | tests/compiler/dart2js/kernel/compile_from_dill_test_helper.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 a79037a6dafd542530dc1c04c95a039af44e85f7..a2e16472030d7cac86e9b8592339cee7bc3160ce 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -91,7 +91,7 @@ class KernelToLocalsMapImpl implements KernelToLocalsMap {
@override
JumpTarget getJumpTargetForDo(ir.DoStatement node) {
_ensureJumpMap(node);
- return _jumpTargetMap[node.parent];
+ return _jumpTargetMap[node];
}
@override
@@ -103,8 +103,7 @@ class KernelToLocalsMapImpl implements KernelToLocalsMap {
@override
JumpTarget getJumpTargetForSwitch(ir.SwitchStatement node) {
_ensureJumpMap(node);
- throw new UnimplementedError(
- 'KernelToLocalsMapImpl.getJumpTargetForSwitch');
+ return _jumpTargetMap[node];
}
@override
@@ -158,17 +157,19 @@ class JumpVisitor extends ir.Visitor {
defaultNode(ir.Node node) => node.visitChildren(this);
bool _canBeBreakTarget(ir.TreeNode node) {
- // TODO(johnniwinther): Add more.
return node is ir.ForStatement ||
node is ir.ForInStatement ||
- node is ir.WhileStatement;
+ node is ir.WhileStatement ||
+ node is ir.DoStatement ||
+ node is ir.SwitchStatement;
}
bool _canBeContinueTarget(ir.TreeNode node) {
// TODO(johnniwinther): Add more.
return node is ir.ForStatement ||
node is ir.ForInStatement ||
- node is ir.WhileStatement;
+ node is ir.WhileStatement ||
+ node is ir.DoStatement;
}
@override
« no previous file with comments | « no previous file | tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698