Files
sdk/tests/language/try_catch_syntax_test.dart
T
hausner@google.com 29f91cc6f4 Implement new catch syntax in vm compiler
- Support for new on T catch (e) syntax
- warning (default:off) when old catch clause syntax is found
- convert one language test to used new catch syntax
Review URL: https://chromiumcodereview.appspot.com//10827240

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10456 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-09 20:14:18 +00:00

41 lines
1.1 KiB
Dart

// Copyright (c) 2012, 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.
main() {
testMissingCatch();
testMissingTry();
testDuplicateCatchVariable();
testIllegalFinally();
testIllegalCatch();
testIllegalRethrow();
}
testMissingCatch() {
try { } /// 01: compile-time error
}
testMissingTry() {
catch (Exception e) { } /// 02: compile-time error
catch (Exception e, StackTrace trace) { } /// 03: compile-time error
finally { } /// 04: compile-time error
}
testDuplicateCatchVariable() {
try { } catch (Exception e, StackTrace e) { } /// 05: compile-time error
}
testIllegalFinally() {
try { } finally (e) { } /// 06: compile-time error
}
testIllegalCatch() {
try { } catch () { } /// 07: compile-time error
try { } catch (MammaMia e) { } /// 09: compile-time error
}
testIllegalRethrow() {
try { throw; } catch (var e) { } /// 10: compile-time error
try { } catch (var e) { } finally { throw; } /// 11: compile-time error
}