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

Side by Side Diff: pkg/compiler/lib/src/kernel/kernel_visitor.dart

Issue 2644293004: Fix labeled break statements. (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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 import 'package:kernel/frontend/accessors.dart' 6 import 'package:kernel/frontend/accessors.dart'
7 show 7 show
8 Accessor, 8 Accessor,
9 IndexAccessor, 9 IndexAccessor,
10 NullAwarePropertyAccessor, 10 NullAwarePropertyAccessor,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 ir.Statement buildBreakTarget( 403 ir.Statement buildBreakTarget(
404 ir.Statement statement, Node node, JumpTarget jumpTarget) { 404 ir.Statement statement, Node node, JumpTarget jumpTarget) {
405 assert(node.isValidBreakTarget()); 405 assert(node.isValidBreakTarget());
406 assert(jumpTarget == elements.getTargetDefinition(node)); 406 assert(jumpTarget == elements.getTargetDefinition(node));
407 associateNode(statement, node); 407 associateNode(statement, node);
408 if (jumpTarget != null && jumpTarget.isBreakTarget) { 408 if (jumpTarget != null && jumpTarget.isBreakTarget) {
409 ir.LabeledStatement breakTarget = getBreakTarget(jumpTarget); 409 ir.LabeledStatement breakTarget = getBreakTarget(jumpTarget);
410 breakTarget.body = statement; 410 breakTarget.body = statement;
411 statement.parent = breakTarget; 411 statement.parent = breakTarget;
412 print('a target: $statement ${statement.runtimeType}');
sra1 2017/01/21 00:17:18 remove
412 return breakTarget; 413 return breakTarget;
413 } else { 414 } else {
414 return statement; 415 return statement;
415 } 416 }
416 } 417 }
417 418
418 ir.Statement buildContinueTarget( 419 ir.Statement buildContinueTarget(
419 ir.Statement statement, Node node, JumpTarget jumpTarget) { 420 ir.Statement statement, Node node, JumpTarget jumpTarget) {
420 assert(node.isValidContinueTarget()); 421 assert(node.isValidContinueTarget());
421 assert(jumpTarget == elements.getTargetDefinition(node)); 422 assert(jumpTarget == elements.getTargetDefinition(node));
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 return internalError(node, "TypeVariable"); 1103 return internalError(node, "TypeVariable");
1103 } 1104 }
1104 1105
1105 @override 1106 @override
1106 ir.Statement visitWhile(While node) { 1107 ir.Statement visitWhile(While node) {
1107 ir.Expression condition = visitForValue(node.condition); 1108 ir.Expression condition = visitForValue(node.condition);
1108 JumpTarget jumpTarget = elements.getTargetDefinition(node); 1109 JumpTarget jumpTarget = elements.getTargetDefinition(node);
1109 ir.Statement body = 1110 ir.Statement body =
1110 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget); 1111 buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget);
1111 return buildBreakTarget( 1112 return buildBreakTarget(
1112 associateNode(new ir.WhileStatement(condition, body), node), 1113 new ir.WhileStatement(condition, body),
1113 node, 1114 node,
1114 jumpTarget); 1115 jumpTarget);
1115 } 1116 }
1116 1117
1117 @override 1118 @override
1118 ir.YieldStatement visitYield(Yield node) { 1119 ir.YieldStatement visitYield(Yield node) {
1119 return new ir.YieldStatement(visitForValue(node.expression), 1120 return new ir.YieldStatement(visitForValue(node.expression),
1120 isYieldStar: node.hasStar); 1121 isYieldStar: node.hasStar);
1121 } 1122 }
1122 1123
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 : this(null, true, node, initializers); 2860 : this(null, true, node, initializers);
2860 2861
2861 accept(ir.Visitor v) => throw "unsupported"; 2862 accept(ir.Visitor v) => throw "unsupported";
2862 2863
2863 visitChildren(ir.Visitor v) => throw "unsupported"; 2864 visitChildren(ir.Visitor v) => throw "unsupported";
2864 2865
2865 String toString() { 2866 String toString() {
2866 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 2867 return "IrFunction($kind, $isConstructor, $node, $initializers)";
2867 } 2868 }
2868 } 2869 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698