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

Unified Diff: tests/language/try_catch_test.dart

Issue 63983005: Simplify the desugaring of catch clauses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated final review comments. Created 7 years, 1 month 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/symbols.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/try_catch_test.dart
diff --git a/tests/language/try_catch_test.dart b/tests/language/try_catch_test.dart
index ff567d77f138bcacdd4360f61a93080d3c21f4d0..fb3630033abb8ed735ec6f6a160d4343903046e1 100644
--- a/tests/language/try_catch_test.dart
+++ b/tests/language/try_catch_test.dart
@@ -147,6 +147,33 @@ class TryCatchTest {
}
}
+ static void test11() {
+ var e0 = 11;
+ try {
+ throw "up";
+ } on int catch (e0) {
+ Expect.fail("unreachable");
+ } on String catch (e1) {
+ // e0 from the other catch clause is not in scope.
+ Expect.equals(11, e0);
+ }
+ }
+
+ static void test12() {
+ const x = const [];
+ try {
+ throw "up";
+ } catch (e) {
+ Expect.equals("up", e);
+ } on String catch (e) {
+ // Compile-time constants in unreachable catch blocks are still
+ // compiled.
+ const y = x[0]; /// 01: compile-time error
+ Expect.fail("unreachable");
+ }
+ }
+
+
static void testMain() {
test1();
test2();
@@ -158,6 +185,8 @@ class TryCatchTest {
test8();
test9();
test10();
+ test11();
+ test12();
}
}
« no previous file with comments | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698