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

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

Issue 989503002: Fix dart2js async error handling of finallies nested in finallies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | tests/language/async_throw_in_catch_test.dart » ('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 1490ada8cc61d4082c436dbefdf0910dd5e23f9c..c2863c5d895c9e32fc00dcc6819e9818b200cf4d 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -659,7 +659,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
_makeVariableInitializer(handler, js.number(rethrowLabel)));
variables.add(_makeVariableInitializer(currentError, null));
if (analysis.hasFinally || (isAsyncStar && analysis.hasYield)) {
- variables.add(_makeVariableInitializer(next, null));
+ variables.add(_makeVariableInitializer(next,
+ new js.ArrayInitializer(<js.Expression>[])));
}
if (analysis.hasThis && !isSyncStar) {
// Sync* functions must remember `this` on the level of the outer
@@ -1416,7 +1417,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
} else {
// The handler is reset as the first thing in the finally block.
addStatement(
- js.js.statement("# = [#];", [next, js.number(afterFinallyLabel)]));
+ js.js.statement("#.push(#);", [next, js.number(afterFinallyLabel)]));
addGoto(finallyLabel);
}
@@ -1440,8 +1441,9 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
if (node.finallyPart != null) {
// The error has been caught, so after the finally, continue after the
// try.
- addStatement(js.js.statement("# = [#];",
- [next, js.number(afterFinallyLabel)]));
+ addStatement(
+ js.js.statement("#.push(#);",
+ [next, js.number(afterFinallyLabel)]));
addGoto(finallyLabel);
} else {
addGoto(afterFinallyLabel);
« no previous file with comments | « no previous file | tests/language/async_throw_in_catch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698