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

Unified Diff: tests/language/try_catch_test.dart

Issue 10827240: Implement new catch syntax in vm compiler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « tests/language/try_catch_syntax_test.dart ('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
===================================================================
--- tests/language/try_catch_test.dart (revision 10450)
+++ tests/language/try_catch_test.dart (working copy)
@@ -2,28 +2,22 @@
// 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.
-class MyException {
- MyException() {}
-}
+class MyException { }
-class MyException1 extends MyException {
- MyException1() : super() {}
-}
+class MyException1 extends MyException { }
-class MyException2 extends MyException {
- MyException2() : super() {}
-}
+class MyException2 extends MyException { }
class TryCatchTest {
static void test1() {
var foo = 0;
try {
throw new MyException1();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 2;
- } catch (MyException e) {
+ } on MyException catch (e) {
foo = 3;
}
Expect.equals(2, foo);
@@ -33,11 +27,11 @@
var foo = 0;
try {
throw new MyException1();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException e) {
+ } on MyException catch (e) {
foo = 2;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 3;
}
Expect.equals(2, foo);
@@ -47,11 +41,11 @@
var foo = 0;
try {
throw new MyException();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 2;
- } catch (MyException e) {
+ } on MyException catch (e) {
foo = 3;
}
Expect.equals(3, foo);
@@ -62,12 +56,12 @@
try {
try {
throw new MyException();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 2;
}
- } catch (MyException e) {
+ } on MyException catch (e) {
Expect.equals(0, foo);
foo = 3;
}
@@ -78,9 +72,9 @@
var foo = 0;
try {
throw new MyException1();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (var e) {
+ } catch (e) {
foo = 2;
}
Expect.equals(2, foo);
@@ -90,11 +84,11 @@
var foo = 0;
try {
throw new MyException();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 2;
- } catch (var e) {
+ } catch (e) {
foo = 3;
}
Expect.equals(3, foo);
@@ -105,12 +99,12 @@
try {
try {
throw new MyException();
- } catch (MyException2 e) {
+ } on MyException2 catch (e) {
foo = 1;
- } catch (MyException1 e) {
+ } on MyException1 catch (e) {
foo = 2;
}
- } catch (var e) {
+ } catch (e) {
Expect.equals(0, foo);
foo = 3;
}
@@ -122,7 +116,7 @@
var caught = false;
try {
throw new MyException();
- } catch (var exc) {
+ } catch (exc) {
caught = true;
}
Expect.equals(true, caught);
« no previous file with comments | « tests/language/try_catch_syntax_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698