| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 "dart:async"; | |
| 6 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 8 | 7 |
| 9 @lazy import "deferred_constraints_constants_lib.dart" as lib; | 8 import "deferred_constraints_constants_lib.dart" deferred as lib; |
| 10 | |
| 11 const lazy = const DeferredLibrary('lib'); | |
| 12 | 9 |
| 13 const myConst1 = | 10 const myConst1 = |
| 14 lib.constantInstance; /// reference1: compile-time error | 11 lib.constantInstance; /// reference1: compile-time error |
| 15 /* /// reference1: continued | 12 /* /// reference1: continued |
| 16 499; | 13 499; |
| 17 */ /// reference1: continued | 14 */ /// reference1: continued |
| 18 const myConst2 = | 15 const myConst2 = |
| 19 lib.Const.instance; /// reference2: compile-time error | 16 lib.Const.instance; /// reference2: compile-time error |
| 20 /* /// reference2: continued | 17 /* /// reference2: continued |
| 21 499; | 18 499; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 @lib.Const.instance /// metadata2: compile-time error | 37 @lib.Const.instance /// metadata2: compile-time error |
| 41 class H2 {} | 38 class H2 {} |
| 42 @lib.Const.namedConstructor() /// metadata3: compile-time error | 39 @lib.Const.namedConstructor() /// metadata3: compile-time error |
| 43 class H3 {} | 40 class H3 {} |
| 44 | 41 |
| 45 void main() { | 42 void main() { |
| 46 var a1 = myConst1; | 43 var a1 = myConst1; |
| 47 var a2 = myConst2; | 44 var a2 = myConst2; |
| 48 | 45 |
| 49 asyncStart(); | 46 asyncStart(); |
| 50 lazy.load().then((_) { | 47 lib.loadLibrary().then((_) { |
| 51 var instance = lib.constantInstance; | 48 var instance = lib.constantInstance; |
| 52 var c1 = const lib.Const(); /// constructor1: compile-time error | 49 var c1 = const lib.Const(); /// constructor1: compile-time error |
| 53 var c2 = const lib.Const.namedConstructor(); /// constructor2: compile-time
error | 50 var c2 = const lib.Const.namedConstructor(); /// constructor2: compile-time
error |
| 54 f1(); | 51 f1(); |
| 55 f2(); | 52 f2(); |
| 56 var constInstance = lib.constantInstance; /// reference_after_load: ok | 53 var constInstance = lib.constantInstance; /// reference_after_load: ok |
| 57 var h1 = new H1(); | 54 var h1 = new H1(); |
| 58 var h2 = new H2(); | 55 var h2 = new H2(); |
| 59 var h3 = new H3(); | 56 var h3 = new H3(); |
| 60 asyncEnd(); | 57 asyncEnd(); |
| 61 }); | 58 }); |
| 62 } | 59 } |
| 63 | 60 |
| OLD | NEW |