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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1253333002: dart2js cps: Support async/await by rewriting the JavaScript AST. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add issue number to status file. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import '../constants/values.dart' as values show ConstantValue; 6 import '../constants/values.dart' as values show ConstantValue;
7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../io/source_information.dart' show SourceInformation; 9 import '../io/source_information.dart' show SourceInformation;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1080
1081 @override 1081 @override
1082 accept(Visitor visitor) { 1082 accept(Visitor visitor) {
1083 return visitor.visitTypeExpression(this); 1083 return visitor.visitTypeExpression(this);
1084 } 1084 }
1085 1085
1086 bool get isSafeForElimination => true; 1086 bool get isSafeForElimination => true;
1087 bool get isSafeForReordering => true; 1087 bool get isSafeForReordering => true;
1088 } 1088 }
1089 1089
1090 class Await extends CallExpression {
1091 final Reference<Primitive> input;
1092 final Reference<Continuation> continuation;
1093
1094 Await(Primitive input, Continuation continuation)
1095 : this.input = new Reference<Primitive>(input),
1096 this.continuation = new Reference<Continuation>(continuation);
1097
1098 @override
1099 accept(Visitor visitor) {
1100 return visitor.visitAwait(this);
1101 }
1102 }
1103
1090 List<Reference<Primitive>> _referenceList(Iterable<Primitive> definitions) { 1104 List<Reference<Primitive>> _referenceList(Iterable<Primitive> definitions) {
1091 return definitions.map((e) => new Reference<Primitive>(e)).toList(); 1105 return definitions.map((e) => new Reference<Primitive>(e)).toList();
1092 } 1106 }
1093 1107
1094 abstract class Visitor<T> { 1108 abstract class Visitor<T> {
1095 const Visitor(); 1109 const Visitor();
1096 1110
1097 T visit(Node node); 1111 T visit(Node node);
1098 1112
1099 // Concrete classes. 1113 // Concrete classes.
(...skipping 11 matching lines...) Expand all
1111 T visitInvokeConstructor(InvokeConstructor node); 1125 T visitInvokeConstructor(InvokeConstructor node);
1112 T visitThrow(Throw node); 1126 T visitThrow(Throw node);
1113 T visitRethrow(Rethrow node); 1127 T visitRethrow(Rethrow node);
1114 T visitBranch(Branch node); 1128 T visitBranch(Branch node);
1115 T visitTypeCast(TypeCast node); 1129 T visitTypeCast(TypeCast node);
1116 T visitSetMutable(SetMutable node); 1130 T visitSetMutable(SetMutable node);
1117 T visitSetStatic(SetStatic node); 1131 T visitSetStatic(SetStatic node);
1118 T visitGetLazyStatic(GetLazyStatic node); 1132 T visitGetLazyStatic(GetLazyStatic node);
1119 T visitSetField(SetField node); 1133 T visitSetField(SetField node);
1120 T visitUnreachable(Unreachable node); 1134 T visitUnreachable(Unreachable node);
1135 T visitAwait(Await node);
1121 1136
1122 // Definitions. 1137 // Definitions.
1123 T visitLiteralList(LiteralList node); 1138 T visitLiteralList(LiteralList node);
1124 T visitLiteralMap(LiteralMap node); 1139 T visitLiteralMap(LiteralMap node);
1125 T visitConstant(Constant node); 1140 T visitConstant(Constant node);
1126 T visitCreateFunction(CreateFunction node); 1141 T visitCreateFunction(CreateFunction node);
1127 T visitGetMutable(GetMutable node); 1142 T visitGetMutable(GetMutable node);
1128 T visitParameter(Parameter node); 1143 T visitParameter(Parameter node);
1129 T visitContinuation(Continuation node); 1144 T visitContinuation(Continuation node);
1130 T visitMutableVariable(MutableVariable node); 1145 T visitMutableVariable(MutableVariable node);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 processReference(node.continuation); 1431 processReference(node.continuation);
1417 } 1432 }
1418 node.arguments.forEach(processReference); 1433 node.arguments.forEach(processReference);
1419 } 1434 }
1420 1435
1421 processUnreachable(Unreachable node) {} 1436 processUnreachable(Unreachable node) {}
1422 visitUnreachable(Unreachable node) { 1437 visitUnreachable(Unreachable node) {
1423 processUnreachable(node); 1438 processUnreachable(node);
1424 } 1439 }
1425 1440
1441 processAwait(Await node) {}
1442 visitAwait(Await node) {
1443 processAwait(node);
1444 processReference(node.input);
1445 processReference(node.continuation);
1446 }
1447
1426 processGetLength(GetLength node) {} 1448 processGetLength(GetLength node) {}
1427 visitGetLength(GetLength node) { 1449 visitGetLength(GetLength node) {
1428 processGetLength(node); 1450 processGetLength(node);
1429 processReference(node.object); 1451 processReference(node.object);
1430 } 1452 }
1431 1453
1432 processGetIndex(GetIndex node) {} 1454 processGetIndex(GetIndex node) {}
1433 visitGetIndex(GetIndex node) { 1455 visitGetIndex(GetIndex node) {
1434 processGetIndex(node); 1456 processGetIndex(node);
1435 processReference(node.object); 1457 processReference(node.object);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 /// Visit a just-deleted subterm and unlink all [Reference]s in it. 1589 /// Visit a just-deleted subterm and unlink all [Reference]s in it.
1568 class RemovalVisitor extends RecursiveVisitor { 1590 class RemovalVisitor extends RecursiveVisitor {
1569 processReference(Reference reference) { 1591 processReference(Reference reference) {
1570 reference.unlink(); 1592 reference.unlink();
1571 } 1593 }
1572 1594
1573 static void remove(Node node) { 1595 static void remove(Node node) {
1574 (new RemovalVisitor()).visit(node); 1596 (new RemovalVisitor()).visit(node);
1575 } 1597 }
1576 } 1598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698