Chromium Code Reviews| Index: tests/language/execute_finally10_test.dart |
| =================================================================== |
| --- tests/language/execute_finally10_test.dart (revision 0) |
| +++ tests/language/execute_finally10_test.dart (revision 0) |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2013, 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 dart2js that used to not treat the finally |
| +// block as a successor of a catch block that throws. |
| + |
| +import "package:expect/expect.dart"; |
| + |
| +class A { |
| + var field; |
| + start() {} |
| + stop() { field = 42; } |
| +} |
| + |
| +class B { |
| + var totalCompileTime = new A(); |
| + var runCompiler = new Object(); |
| + |
| + run() { |
| + totalCompileTime.start(); |
| + try { |
| + throw 'foo'; |
| + } catch (exception) { |
| + runCompiler.toString(); |
|
kasperl
2013/04/11 12:28:53
Is it impossible to simplify this?
ngeoffray
2013/04/11 12:52:28
I have to use a field twice, to ensure there is a
|
| + runCompiler.toString(); |
| + throw; |
| + } finally { |
| + totalCompileTime.stop(); |
| + } |
| + } |
| +} |
| + |
| +main() { |
| + var b = new B(); |
| + try { |
| + b.run(); |
| + throw 'Expected exception'; |
| + } catch (exception) { |
| + // Expected exception. |
| + } |
| + |
| + Expect.equals(42, b.totalCompileTime.field); |
| +} |