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()); |
+} |