OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 'package:async_helper/async_helper.dart'; | 5 import 'package:async_helper/async_helper.dart'; |
6 import 'package:compiler/src/constants/values.dart' | 6 import 'package:compiler/src/constants/values.dart' |
7 show PrimitiveConstantValue; | 7 show PrimitiveConstantValue; |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
10 import 'package:compiler/src/parser/partial_elements.dart' show | 10 import 'package:compiler/src/parser/partial_elements.dart' show |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 Uri libUri = new Uri(scheme: 'source', path: 'lib.dart'); | 170 Uri libUri = new Uri(scheme: 'source', path: 'lib.dart'); |
171 String libSource = 'library lib;'; | 171 String libSource = 'library lib;'; |
172 | 172 |
173 Uri uri = new Uri(scheme: 'source', path: 'main.dart'); | 173 Uri uri = new Uri(scheme: 'source', path: 'main.dart'); |
174 | 174 |
175 var compiler = compilerFor(source, uri) | 175 var compiler = compilerFor(source, uri) |
176 ..registerSource(partUri, partSource) | 176 ..registerSource(partUri, partSource) |
177 ..registerSource(libUri, libSource); | 177 ..registerSource(libUri, libSource); |
178 | 178 |
179 asyncTest(() => compiler.runCompiler(uri).then((_) { | 179 asyncTest(() => compiler.run(uri).then((_) { |
180 compiler.enqueuer.resolution.queueIsClosed = false; | 180 compiler.enqueuer.resolution.queueIsClosed = false; |
181 LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); | 181 LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); |
182 Expect.isNotNull(element, 'Cannot find $uri'); | 182 Expect.isNotNull(element, 'Cannot find $uri'); |
183 | 183 |
184 List<MetadataAnnotation> metadata = extractMetadata(element); | 184 List<MetadataAnnotation> metadata = extractMetadata(element); |
185 Expect.equals(1, metadata.length); | 185 Expect.equals(1, metadata.length); |
186 | 186 |
187 PartialMetadataAnnotation annotation = metadata.first; | 187 PartialMetadataAnnotation annotation = metadata.first; |
188 annotation.ensureResolved(compiler.resolution); | 188 annotation.ensureResolved(compiler.resolution); |
189 PrimitiveConstantValue value = | 189 PrimitiveConstantValue value = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 compileAndCheckLibrary(source, | 228 compileAndCheckLibrary(source, |
229 (e) => e.compilationUnits.first.partTag.metadata); | 229 (e) => e.compilationUnits.first.partTag.metadata); |
230 } | 230 } |
231 | 231 |
232 void main() { | 232 void main() { |
233 testClassMetadata(); | 233 testClassMetadata(); |
234 testTopLevelMethodMetadata(); | 234 testTopLevelMethodMetadata(); |
235 testTopLevelFieldMetadata(); | 235 testTopLevelFieldMetadata(); |
236 testLibraryTags(); | 236 testLibraryTags(); |
237 } | 237 } |
OLD | NEW |