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 // Imported by deferred_class_test.dart. | 5 // Imported by deferred_class_test.dart. |
6 | 6 |
7 library deferred_class_library2; | 7 library deferred_class_library2; |
8 | 8 |
9 class MyClass { | 9 class MyClass { |
10 const MyClass(); | 10 const MyClass(); |
11 | 11 |
12 foo(x) { | 12 foo(x) { |
13 print('MyClass.foo($x)'); | 13 print('MyClass.foo($x)'); |
14 return (x - 3) ~/ 2; | 14 return (x - 3) ~/ 2; |
15 } | 15 } |
16 } | 16 } |
17 | 17 |
18 class Constant { | 18 class Constant { |
19 final value; | 19 final value; |
20 const Constant(this.value); | 20 const Constant(this.value); |
21 | 21 |
22 operator==(other) => other is Constant && value == other.value; | 22 operator ==(other) => other is Constant && value == other.value; |
23 get hashCode => 0; | 23 get hashCode => 0; |
24 } | 24 } |
25 | 25 |
26 const C1 = const Constant(499); | 26 const C1 = const Constant(499); |
27 const C2 = const [const Constant(99)]; | 27 const C2 = const [const Constant(99)]; |
28 | 28 |
29 foo([x = const Constant(42)]) => x; | 29 foo([x = const Constant(42)]) => x; |
30 bar() => const Constant(777); | 30 bar() => const Constant(777); |
31 | 31 |
32 class Gee { | 32 class Gee { |
33 get value => c.value; | 33 get value => c.value; |
34 final c; | 34 final c; |
35 | 35 |
36 Gee([this.c = const Constant(111)]); | 36 Gee([this.c = const Constant(111)]); |
37 const Gee.n321([this.c = const Constant(321)]); | 37 const Gee.n321([this.c = const Constant(321)]); |
38 Gee.n135({ arg: const Constant(135) }) : this.c = arg; | 38 Gee.n135({arg: const Constant(135)}) : this.c = arg; |
39 const Gee.n246({ arg: const Constant(246) }) : this.c = arg; | 39 const Gee.n246({arg: const Constant(246)}) : this.c = arg; |
40 const Gee.n888() : this.c = const Constant(888); | 40 const Gee.n888() : this.c = const Constant(888); |
41 const Gee.constant(this.c); | 41 const Gee.constant(this.c); |
42 } | 42 } |
43 | 43 |
44 class Gee2 extends Gee { | 44 class Gee2 extends Gee { |
45 Gee2() : super(const Constant(979)); | 45 Gee2() : super(const Constant(979)); |
46 const Gee2.n321(): super.n321(); | 46 const Gee2.n321() : super.n321(); |
47 const Gee2.n151(): super.constant(const Constant(151)); | 47 const Gee2.n151() : super.constant(const Constant(151)); |
48 const Gee2.n888() : super.n888(); | 48 const Gee2.n888() : super.n888(); |
49 } | 49 } |
OLD | NEW |