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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.dart

Issue 1427593003: dart2js: Bugfix for when 'await' occurs in an initializer list. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/rewrite_async.dart
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index 4be28d1ce0411fd853e829bd695b86d518deae4c..8a52f3c11de889d2eb4fb4fe3075bb1680ddaae2 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -1023,7 +1023,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
}
if (node.init != null) {
- addExpressionStatement(visitExpression(node.init));
+ visitExpressionIgnoreResult(node.init);
}
int startLabel = newLabel("for condition");
// If there is no update, continuing the loop is the same as going to the
@@ -1553,29 +1553,17 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
@override
js.Expression visitVariableDeclarationList(js.VariableDeclarationList node) {
- List<js.Expression> initializations = new List<js.Expression>();
-
- // Declaration of local variables is hoisted outside the helper but the
- // initialization is done here.
for (js.VariableInitialization initialization in node.declarations) {
js.VariableDeclaration declaration = initialization.declaration;
localVariables.add(declaration);
if (initialization.value != null) {
withExpression(initialization.value, (js.Expression value) {
- initializations.add(
+ addExpressionStatement(
new js.Assignment(new js.VariableUse(declaration.name), value));
}, store: false);
}
}
- if (initializations.isEmpty) {
- // Dummy expression. Will be dropped by [visitExpressionIgnoreResult].
- return js.number(0);
- } else {
- return initializations.reduce(
- (js.Expression first, js.Expression second) {
- return new js.Binary(",", first, second);
- });
- }
+ return js.number(0); // Dummy expression.
}
@override
« no previous file with comments | « no previous file | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698