dart-sdk/tests/language/exception/multiple_breaks_crossing_finally_test.dart
Aske Simon Christensen 7a63ff2604 [dart2wasm] Fix reversal of break labels crossing finally.
The block starts and ends for the entry points to the finally block
instances corresponding to break paths were emitted in the same order,
causing the jump targets to be reversed.

Change-Id: Ifc8a6b6320ba7341140606c98333f5825d2228ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283042
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-02-15 10:24:08 +00:00

34 lines
622 B
Dart

// Copyright (c) 2023, 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";
String test(int n) {
String s = "$n";
a:
{
b:
{
try {
if (n == 1) {
break a;
} else {
break b;
}
s += "/";
} finally {
s += "-";
}
s += "*";
}
return s + "b";
}
return s + "a";
}
main() {
Expect.equals("1-a", test(1));
Expect.equals("2-b", test(2));
}