OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Dart2js failed when a declared function was captured inside itself. | |
8 | |
9 foo(f) => f(499); | |
10 | |
11 main() { | 7 main() { |
12 fun(x) { | 8 try { |
13 if (x < 3) { | 9 Uri base = Uri.base; |
14 return foo((x) => fun(x)); | 10 Expect.isTrue(Uri.base.scheme == "file" || Uri.base.scheme == "http"); |
15 } else { | 11 } on UnsupportedError catch (e) { |
16 return x; | 12 Expect.isTrue( |
17 } | 13 e.toString().contains("'Uri.base' is not supported")); |
18 } | 14 } |
19 Expect.equals(499, fun(499)); | |
20 } | 15 } |
OLD | NEW |