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 library initialize.transformer_test; | 4 library initialize.transformer_test; |
5 | 5 |
6 import 'common.dart'; | 6 import 'common.dart'; |
7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
8 import 'package:dart_style/dart_style.dart'; | 8 import 'package:dart_style/dart_style.dart'; |
9 import 'package:initialize/transformer.dart'; | 9 import 'package:initialize/transformer.dart'; |
10 import 'package:unittest/compact_vm_config.dart'; | 10 import 'package:unittest/compact_vm_config.dart'; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 'a|web/index.dart': ''' | 117 'a|web/index.dart': ''' |
118 @DynamicInit(foo) | 118 @DynamicInit(foo) |
119 @DynamicInit(Foo.foo) | 119 @DynamicInit(Foo.foo) |
120 @DynamicInit(const [foo, Foo.foo, 'foo']) | 120 @DynamicInit(const [foo, Foo.foo, 'foo']) |
121 @DynamicInit(const {'foo': foo, 'Foo.foo': Foo.foo, 'bar': 'bar'}) | 121 @DynamicInit(const {'foo': foo, 'Foo.foo': Foo.foo, 'bar': 'bar'}) |
122 @DynamicInit('foo') | 122 @DynamicInit('foo') |
123 @DynamicInit(true) | 123 @DynamicInit(true) |
124 @DynamicInit(null) | 124 @DynamicInit(null) |
125 @DynamicInit(1) | 125 @DynamicInit(1) |
126 @DynamicInit(1.1) | 126 @DynamicInit(1.1) |
| 127 @DynamicInit('foo-\$x\${y}') |
| 128 @DynamicInit(1 + 2) |
| 129 @DynamicInit(1.0 + 0.2) |
| 130 @DynamicInit(1 == 1) |
127 @NamedArgInit(1, name: 'Bill') | 131 @NamedArgInit(1, name: 'Bill') |
128 library web_foo; | 132 library web_foo; |
129 | 133 |
130 import 'package:test_initializers/common.dart'; | 134 import 'package:test_initializers/common.dart'; |
131 import 'foo.dart'; | 135 import 'foo.dart'; |
| 136 |
| 137 const x = 'x'; |
| 138 const y = 'y'; |
| 139 |
| 140 class MyConst { |
| 141 const MyConst; |
| 142 } |
132 ''', | 143 ''', |
133 'a|web/foo.dart': ''' | 144 'a|web/foo.dart': ''' |
134 library foo; | 145 library foo; |
135 | 146 |
136 const String foo = 'foo'; | 147 const String foo = 'foo'; |
137 | 148 |
138 class Foo { | 149 class Foo { |
139 static foo = 'Foo.foo'; | 150 static foo = 'Foo.foo'; |
140 } | 151 } |
141 ''', | 152 ''', |
(...skipping 12 matching lines...) Expand all Loading... |
154 initializers.addAll([ | 165 initializers.addAll([ |
155 new InitEntry(const i1.DynamicInit(i2.foo), const LibraryIdentifier(
#web_foo, null, 'index.dart')), | 166 new InitEntry(const i1.DynamicInit(i2.foo), const LibraryIdentifier(
#web_foo, null, 'index.dart')), |
156 new InitEntry(const i1.DynamicInit(i2.Foo.foo), const LibraryIdentif
ier(#web_foo, null, 'index.dart')), | 167 new InitEntry(const i1.DynamicInit(i2.Foo.foo), const LibraryIdentif
ier(#web_foo, null, 'index.dart')), |
157 new InitEntry(const i1.DynamicInit(const [i2.foo, i2.Foo.foo, 'foo']
), const LibraryIdentifier(#web_foo, null, 'index.dart')), | 168 new InitEntry(const i1.DynamicInit(const [i2.foo, i2.Foo.foo, 'foo']
), const LibraryIdentifier(#web_foo, null, 'index.dart')), |
158 new InitEntry(const i1.DynamicInit(const {'foo': i2.foo, 'Foo.foo':
i2.Foo.foo, 'bar': 'bar'}), const LibraryIdentifier(#web_foo, null, 'index.dart'
)), | 169 new InitEntry(const i1.DynamicInit(const {'foo': i2.foo, 'Foo.foo':
i2.Foo.foo, 'bar': 'bar'}), const LibraryIdentifier(#web_foo, null, 'index.dart'
)), |
159 new InitEntry(const i1.DynamicInit('foo'), const LibraryIdentifier(#
web_foo, null, 'index.dart')), | 170 new InitEntry(const i1.DynamicInit('foo'), const LibraryIdentifier(#
web_foo, null, 'index.dart')), |
160 new InitEntry(const i1.DynamicInit(true), const LibraryIdentifier(#w
eb_foo, null, 'index.dart')), | 171 new InitEntry(const i1.DynamicInit(true), const LibraryIdentifier(#w
eb_foo, null, 'index.dart')), |
161 new InitEntry(const i1.DynamicInit(null), const LibraryIdentifier(#w
eb_foo, null, 'index.dart')), | 172 new InitEntry(const i1.DynamicInit(null), const LibraryIdentifier(#w
eb_foo, null, 'index.dart')), |
162 new InitEntry(const i1.DynamicInit(1), const LibraryIdentifier(#web_
foo, null, 'index.dart')), | 173 new InitEntry(const i1.DynamicInit(1), const LibraryIdentifier(#web_
foo, null, 'index.dart')), |
163 new InitEntry(const i1.DynamicInit(1.1), const LibraryIdentifier(#we
b_foo, null, 'index.dart')), | 174 new InitEntry(const i1.DynamicInit(1.1), const LibraryIdentifier(#we
b_foo, null, 'index.dart')), |
| 175 new InitEntry(const i1.DynamicInit('foo-xy'), const LibraryIdentifie
r(#web_foo, null, 'index.dart')), |
| 176 new InitEntry(const i1.DynamicInit(3), const LibraryIdentifier(#web_
foo, null, 'index.dart')), |
| 177 new InitEntry(const i1.DynamicInit(1.2), const LibraryIdentifier(#we
b_foo, null, 'index.dart')), |
| 178 new InitEntry(const i1.DynamicInit(true), const LibraryIdentifier(#w
eb_foo, null, 'index.dart')), |
164 new InitEntry(const i1.NamedArgInit(1, name: 'Bill'), const LibraryI
dentifier(#web_foo, null, 'index.dart')), | 179 new InitEntry(const i1.NamedArgInit(1, name: 'Bill'), const LibraryI
dentifier(#web_foo, null, 'index.dart')), |
165 ]); | 180 ]); |
166 | 181 |
167 i0.main(); | 182 i0.main(); |
168 } | 183 } |
169 ''') | 184 ''') |
170 }, []); | 185 }, []); |
171 } | 186 } |
172 | 187 |
173 class SkipConstructorsPlugin extends InitializerPlugin { | 188 class SkipConstructorsPlugin extends InitializerPlugin { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 initializers.addAll([ | 239 initializers.addAll([ |
225 new InitEntry(i2.initMethod, i1.foo), | 240 new InitEntry(i2.initMethod, i1.foo), |
226 new InitEntry(i2.initMethod, i0.index), | 241 new InitEntry(i2.initMethod, i0.index), |
227 ]); | 242 ]); |
228 | 243 |
229 i0.main(); | 244 i0.main(); |
230 } | 245 } |
231 ''') | 246 ''') |
232 }, []); | 247 }, []); |
233 } | 248 } |
OLD | NEW |