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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 1580613002: dart2js: Remove rethrow from the CPS and Tree IRs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Restore rethrow to the CPS IR. Created 4 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library tree_ir_nodes; 5 library tree_ir_nodes;
6 6
7 import '../constants/values.dart' as values; 7 import '../constants/values.dart' as values;
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../io/source_information.dart' show SourceInformation; 10 import '../io/source_information.dart' show SourceInformation;
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 600
601 Statement get next => null; 601 Statement get next => null;
602 void set next(Statement s) => throw 'UNREACHABLE'; 602 void set next(Statement s) => throw 'UNREACHABLE';
603 603
604 Throw(this.value); 604 Throw(this.value);
605 605
606 accept(StatementVisitor visitor) => visitor.visitThrow(this); 606 accept(StatementVisitor visitor) => visitor.visitThrow(this);
607 accept1(StatementVisitor1 visitor, arg) => visitor.visitThrow(this, arg); 607 accept1(StatementVisitor1 visitor, arg) => visitor.visitThrow(this, arg);
608 } 608 }
609 609
610 /// A rethrow of an exception.
611 ///
612 /// Rethrow can only occur nested inside a catch block. It implicitly throws
613 /// the block's caught exception value without changing the caught stack
614 /// trace. It does not have a successor statement.
615 class Rethrow extends Statement {
616 Statement get next => null;
617 void set next(Statement s) => throw 'UNREACHABLE';
618
619 Rethrow();
620
621 accept(StatementVisitor visitor) => visitor.visitRethrow(this);
622 accept1(StatementVisitor1 visitor, arg) => visitor.visitRethrow(this, arg);
623 }
624
625 /** 610 /**
626 * A conditional branch based on the true value of an [Expression]. 611 * A conditional branch based on the true value of an [Expression].
627 */ 612 */
628 class If extends Statement { 613 class If extends Statement {
629 Expression condition; 614 Expression condition;
630 Statement thenStatement; 615 Statement thenStatement;
631 Statement elseStatement; 616 Statement elseStatement;
632 617
633 Statement get next => null; 618 Statement get next => null;
634 void set next(Statement s) => throw 'UNREACHABLE'; 619 void set next(Statement s) => throw 'UNREACHABLE';
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 E visitGetIndex(GetIndex node, A arg); 1058 E visitGetIndex(GetIndex node, A arg);
1074 E visitSetIndex(SetIndex node, A arg); 1059 E visitSetIndex(SetIndex node, A arg);
1075 E visitAwait(Await node, A arg); 1060 E visitAwait(Await node, A arg);
1076 } 1061 }
1077 1062
1078 abstract class StatementVisitor<S> { 1063 abstract class StatementVisitor<S> {
1079 S visitStatement(Statement node) => node.accept(this); 1064 S visitStatement(Statement node) => node.accept(this);
1080 S visitLabeledStatement(LabeledStatement node); 1065 S visitLabeledStatement(LabeledStatement node);
1081 S visitReturn(Return node); 1066 S visitReturn(Return node);
1082 S visitThrow(Throw node); 1067 S visitThrow(Throw node);
1083 S visitRethrow(Rethrow node);
1084 S visitBreak(Break node); 1068 S visitBreak(Break node);
1085 S visitContinue(Continue node); 1069 S visitContinue(Continue node);
1086 S visitIf(If node); 1070 S visitIf(If node);
1087 S visitWhileTrue(WhileTrue node); 1071 S visitWhileTrue(WhileTrue node);
1088 S visitFor(For node); 1072 S visitFor(For node);
1089 S visitExpressionStatement(ExpressionStatement node); 1073 S visitExpressionStatement(ExpressionStatement node);
1090 S visitTry(Try node); 1074 S visitTry(Try node);
1091 S visitUnreachable(Unreachable node); 1075 S visitUnreachable(Unreachable node);
1092 S visitForeignStatement(ForeignStatement node); 1076 S visitForeignStatement(ForeignStatement node);
1093 S visitYield(Yield node); 1077 S visitYield(Yield node);
1094 S visitNullCheck(NullCheck node); 1078 S visitNullCheck(NullCheck node);
1095 } 1079 }
1096 1080
1097 abstract class StatementVisitor1<S, A> { 1081 abstract class StatementVisitor1<S, A> {
1098 S visitStatement(Statement node, A arg) => node.accept1(this, arg); 1082 S visitStatement(Statement node, A arg) => node.accept1(this, arg);
1099 S visitLabeledStatement(LabeledStatement node, A arg); 1083 S visitLabeledStatement(LabeledStatement node, A arg);
1100 S visitReturn(Return node, A arg); 1084 S visitReturn(Return node, A arg);
1101 S visitThrow(Throw node, A arg); 1085 S visitThrow(Throw node, A arg);
1102 S visitRethrow(Rethrow node, A arg);
1103 S visitBreak(Break node, A arg); 1086 S visitBreak(Break node, A arg);
1104 S visitContinue(Continue node, A arg); 1087 S visitContinue(Continue node, A arg);
1105 S visitIf(If node, A arg); 1088 S visitIf(If node, A arg);
1106 S visitWhileTrue(WhileTrue node, A arg); 1089 S visitWhileTrue(WhileTrue node, A arg);
1107 S visitFor(For node, A arg); 1090 S visitFor(For node, A arg);
1108 S visitExpressionStatement(ExpressionStatement node, A arg); 1091 S visitExpressionStatement(ExpressionStatement node, A arg);
1109 S visitTry(Try node, A arg); 1092 S visitTry(Try node, A arg);
1110 S visitUnreachable(Unreachable node, A arg); 1093 S visitUnreachable(Unreachable node, A arg);
1111 S visitForeignStatement(ForeignStatement node, A arg); 1094 S visitForeignStatement(ForeignStatement node, A arg);
1112 S visitYield(Yield node, A arg); 1095 S visitYield(Yield node, A arg);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 } 1174 }
1192 1175
1193 visitReturn(Return node) { 1176 visitReturn(Return node) {
1194 visitExpression(node.value); 1177 visitExpression(node.value);
1195 } 1178 }
1196 1179
1197 visitThrow(Throw node) { 1180 visitThrow(Throw node) {
1198 visitExpression(node.value); 1181 visitExpression(node.value);
1199 } 1182 }
1200 1183
1201 visitRethrow(Rethrow node) {}
1202
1203 visitBreak(Break node) {} 1184 visitBreak(Break node) {}
1204 1185
1205 visitContinue(Continue node) {} 1186 visitContinue(Continue node) {}
1206 1187
1207 visitIf(If node) { 1188 visitIf(If node) {
1208 visitExpression(node.condition); 1189 visitExpression(node.condition);
1209 visitStatement(node.thenStatement); 1190 visitStatement(node.thenStatement);
1210 visitStatement(node.elseStatement); 1191 visitStatement(node.elseStatement);
1211 } 1192 }
1212 1193
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 visitReturn(Return node) { 1413 visitReturn(Return node) {
1433 node.value = visitExpression(node.value); 1414 node.value = visitExpression(node.value);
1434 return node; 1415 return node;
1435 } 1416 }
1436 1417
1437 visitThrow(Throw node) { 1418 visitThrow(Throw node) {
1438 node.value = visitExpression(node.value); 1419 node.value = visitExpression(node.value);
1439 return node; 1420 return node;
1440 } 1421 }
1441 1422
1442 visitRethrow(Rethrow node) => node;
1443
1444 visitBreak(Break node) => node; 1423 visitBreak(Break node) => node;
1445 1424
1446 visitContinue(Continue node) => node; 1425 visitContinue(Continue node) => node;
1447 1426
1448 visitIf(If node) { 1427 visitIf(If node) {
1449 node.condition = visitExpression(node.condition); 1428 node.condition = visitExpression(node.condition);
1450 node.thenStatement = visitStatement(node.thenStatement); 1429 node.thenStatement = visitStatement(node.thenStatement);
1451 node.elseStatement = visitStatement(node.elseStatement); 1430 node.elseStatement = visitStatement(node.elseStatement);
1452 return node; 1431 return node;
1453 } 1432 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 1613
1635 /// Number of uses of the current fallthrough target. 1614 /// Number of uses of the current fallthrough target.
1636 int get useCount => _stack.last.useCount; 1615 int get useCount => _stack.last.useCount;
1637 1616
1638 /// Indicate that a statement will fall through to the current fallthrough 1617 /// Indicate that a statement will fall through to the current fallthrough
1639 /// target. 1618 /// target.
1640 void use() { 1619 void use() {
1641 ++_stack.last.useCount; 1620 ++_stack.last.useCount;
1642 } 1621 }
1643 } 1622 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698