Files
sdk/tests/language/switch_try_catch_test.dart
T
fschneider@google.com 96a454a01e Fix try-catch and continue in switch statements.
When assigning the try-index for continue targets, use
the try index of the enclosing nested statement, not the
current try-index of the graph builder.

BUG=dartbug.com/18869
TEST=tests/language/switch_try_catch_test.dart
R=hausner@google.com

Review URL: https://codereview.chromium.org//308053012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36876 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 15:46:31 +00:00

34 lines
735 B
Dart

// Copyright (c) 2014, 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.
// Regression test for issue 18869: Check that try-catch is working correctly
// inside switch-case clauses.
import "package:expect/expect.dart";
test_switch() {
switch(0) {
_0: case 0:
print("_0");
continue _5;
_1: case 1:
try {
print("bunny");
continue _6;
} catch(e) { }
break;
_5: case 5:
print("_5");
continue _6;
_6: case 6:
print("_6");
throw 555;
}
}
main() {
Expect.throws(() => test_switch(), (e) => e == 555);
}