| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Dart version of two-argument Ackermann-Peter function. | 4 // Dart version of two-argument Ackermann-Peter function. |
| 5 | 5 |
| 6 library deferred_load_constants; | 6 library deferred_load_constants; |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 import "deferred_load_constants.dart" deferred as foo; | 10 import "deferred_load_constants.dart" deferred as foo; |
| 11 import "deferred_load_constants.dart"; | 11 import "deferred_load_constants.dart"; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 asyncStart(); | 14 asyncStart(); |
| 15 Expect.throws(() => foo.c); | 15 Expect.throws(() => foo.c); |
| 16 Expect.throws(() => foo.C); | 16 Expect.throws(() => foo.C); |
| 17 Expect.throws(() => foo.funtype); | 17 Expect.throws(() => foo.funtype); |
| 18 Expect.throws(() => foo.toplevel); | 18 Expect.throws(() => foo.toplevel); |
| 19 foo.loadLibrary().whenComplete(() { | 19 foo.loadLibrary().whenComplete(() { |
| 20 // Reading constant declarations through deferred prefix works. | 20 // Reading constant declarations through deferred prefix works. |
| 21 Expect.identical(c, foo.c); | 21 Expect.identical(c, foo.c); |
| 22 Expect.identical(C, foo.C); | 22 Expect.identical(C, foo.C); |
| 23 Expect.identical(funtype, foo.funtype); | 23 Expect.identical(funtype, foo.funtype); |
| 24 Expect.identical(toplevel, foo.toplevel); | 24 Expect.identical(toplevel, foo.toplevel); |
| 25 Expect.identical(C.staticfun, foo.C.staticfun); | 25 Expect.identical(C.staticfun, foo.C.staticfun); |
| 26 // Access through deferred prefix is not a constant expression. | 26 // Access through deferred prefix is not a constant expression. |
| 27 Expect.throws(() => const [foo.c]); /// 01: compile-time error | 27 Expect.throws(() => const [foo.c]); //# 01: compile-time error |
| 28 Expect.throws(() => const [foo.C]); /// 02: compile-time error | 28 Expect.throws(() => const [foo.C]); //# 02: compile-time error |
| 29 Expect.throws(() => const [foo.funtype]); /// 03: compile-time error | 29 Expect.throws(() => const [foo.funtype]); //# 03: compile-time error |
| 30 Expect.throws(() => const [foo.toplevel]); /// 04: compile-time error | 30 Expect.throws(() => const [foo.toplevel]); //# 04: compile-time error |
| 31 Expect.throws(() => const [foo.C.staticfun]); /// 05: compile-time error | 31 Expect.throws(() => const [foo.C.staticfun]); //# 05: compile-time error |
| 32 | 32 |
| 33 asyncEnd(); | 33 asyncEnd(); |
| 34 }); | 34 }); |
| 35 } | 35 } |
| OLD | NEW |