| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "dart:async"; | |
| 6 import 'package:expect/expect.dart'; | |
| 7 import 'package:async_helper/async_helper.dart'; | |
| 8 | |
| 9 @lazy import "deferred_constraints_constants_old_syntax_lib.dart" as lib; | |
| 10 | |
| 11 const lazy = const DeferredLibrary('lib'); | |
| 12 | |
| 13 const myConst1 = | |
| 14 lib.constantInstance; /// reference1: compile-time error | |
| 15 /* /// reference1: continued | |
| 16 499; | |
| 17 */ /// reference1: continued | |
| 18 const myConst2 = | |
| 19 lib.Const.instance; /// reference2: compile-time error | |
| 20 /* /// reference2: continued | |
| 21 499; | |
| 22 */ /// reference2: continued | |
| 23 | |
| 24 void f1({a: | |
| 25 const lib.Const() /// default_argument1: compile-time error | |
| 26 /* /// default_argument1: continued | |
| 27 499 | |
| 28 */ /// default_argument1: continued | |
| 29 }) {} | |
| 30 | |
| 31 void f2({a: | |
| 32 lib.constantInstance /// default_argument2: compile-time error | |
| 33 /* /// default_argument2: continued | |
| 34 499 | |
| 35 */ /// default_argument2: continued | |
| 36 }) {} | |
| 37 | |
| 38 @lib.Const() /// metadata1: compile-time error | |
| 39 class H1 {} | |
| 40 @lib.Const.instance /// metadata2: compile-time error | |
| 41 class H2 {} | |
| 42 @lib.Const.namedConstructor() /// metadata3: compile-time error | |
| 43 class H3 {} | |
| 44 | |
| 45 void main() { | |
| 46 var a1 = myConst1; | |
| 47 var a2 = myConst2; | |
| 48 | |
| 49 asyncStart(); | |
| 50 lazy.load().then((_) { | |
| 51 var instance = lib.constantInstance; | |
| 52 var c1 = const lib.Const(); /// constructor1: compile-time error | |
| 53 var c2 = const lib.Const.namedConstructor(); /// constructor2: compile-time
error | |
| 54 f1(); | |
| 55 f2(); | |
| 56 var constInstance = lib.constantInstance; /// reference_after_load: ok | |
| 57 var h1 = new H1(); | |
| 58 var h2 = new H2(); | |
| 59 var h3 = new H3(); | |
| 60 asyncEnd(); | |
| 61 }); | |
| 62 } | |
| 63 | |
| OLD | NEW |