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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.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: Rewrite to switch. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
index 238a3fc354178c391ded72dc64656a50ce0dca43..8c830953838382a16ce1e888ec5a12cca7b4c944 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart
@@ -353,6 +353,11 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
return giveup(node, 'await for');
}
+ visitAwait(ast.Await node) {
+ ir.Primitive value = visit(node.expression);
+ return irBuilder.buildAwait(value);
+ }
+
visitSyncForIn(ast.SyncForIn node) {
// [node.declaredIdentifier] can be either an [ast.VariableDefinitions]
// (defining a new local variable) or a send designating some existing
@@ -2178,9 +2183,12 @@ class DartCapturedVariables extends ast.Visitor {
visitFunctionExpression(ast.FunctionExpression node) {
FunctionElement oldFunction = currentFunction;
currentFunction = elements[node];
- if (currentFunction.asyncMarker != AsyncMarker.SYNC) {
- giveup(node, "cannot handle async/sync*/async* functions");
+
+ if (currentFunction.asyncMarker != AsyncMarker.SYNC &&
+ currentFunction.asyncMarker != AsyncMarker.ASYNC) {
+ giveup(node, "cannot handle sync*/async* functions");
}
+
if (node.initializers != null) {
insideInitializer = true;
visit(node.initializers);
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698