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

Unified Diff: tests/language/regress_23537_test.dart

Issue 1154823003: Adjust context level when required before executing inlined finally clauses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/regress_23537_test.dart
diff --git a/tests/language/regress_23537_test.dart b/tests/language/regress_23537_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c8c66675761413cdbc177d1f4b7b24d066d04f17
--- /dev/null
+++ b/tests/language/regress_23537_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+var d;
+
+test(a) {
+ while (true) {
+ try {
+ var b;
+ try {
+ for (int i = 0; i < 10; i++) {
+ // Closurizing i, a, and b, thus the return statement
+ // executes at context level 3, and the code in
+ // the finally blocks runs at context level 1 and 2.
+ return () => i + a + b;
+ }
+ } finally {
+ b = 10;
+ while (true) {
+ // Chain a new context.
+ var c = 5;
+ d = () => a + b + c;
+ break;
+ }
+ }
+ } finally {
+ a = 1;
+ }
+ break;
+ }
+}
+
+main() {
+ var c = test(0);
+ Expect.equals(11, c());
+ Expect.equals(16, d());
+}
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698