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:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
8 import 'parser_helper.dart'; | 8 import 'parser_helper.dart'; |
9 import 'package:compiler/implementation/dart2jslib.dart' | 9 import 'package:compiler/implementation/dart2jslib.dart' |
10 show PrimitiveConstant; | 10 show PrimitiveConstant; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 Uri async = new Uri(scheme: 'dart', path: 'async'); | 157 Uri async = new Uri(scheme: 'dart', path: 'async'); |
158 | 158 |
159 var compiler = compilerFor(source, uri) | 159 var compiler = compilerFor(source, uri) |
160 ..registerSource(partUri, partSource) | 160 ..registerSource(partUri, partSource) |
161 ..registerSource(libUri, libSource) | 161 ..registerSource(libUri, libSource) |
162 ..registerSource(async, 'class DeferredLibrary {}'); | 162 ..registerSource(async, 'class DeferredLibrary {}'); |
163 | 163 |
164 asyncTest(() => compiler.runCompiler(uri).then((_) { | 164 asyncTest(() => compiler.runCompiler(uri).then((_) { |
165 compiler.enqueuer.resolution.queueIsClosed = false; | 165 compiler.enqueuer.resolution.queueIsClosed = false; |
166 LibraryElement element = compiler.libraries['$uri']; | 166 LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); |
167 Expect.isNotNull(element, 'Cannot find $uri'); | 167 Expect.isNotNull(element, 'Cannot find $uri'); |
168 | 168 |
169 Link<MetadataAnnotation> metadata = extractMetadata(element); | 169 Link<MetadataAnnotation> metadata = extractMetadata(element); |
170 Expect.equals(1, length(metadata)); | 170 Expect.equals(1, length(metadata)); |
171 | 171 |
172 PartialMetadataAnnotation annotation = metadata.head; | 172 PartialMetadataAnnotation annotation = metadata.head; |
173 annotation.ensureResolved(compiler); | 173 annotation.ensureResolved(compiler); |
174 PrimitiveConstant value = annotation.value; | 174 PrimitiveConstant value = annotation.value; |
175 Expect.stringEquals('xyz', value.value.slowToString()); | 175 Expect.stringEquals('xyz', value.value.slowToString()); |
176 | 176 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 compileAndCheckLibrary(source, | 211 compileAndCheckLibrary(source, |
212 (e) => e.compilationUnits.first.partTag.metadata); | 212 (e) => e.compilationUnits.first.partTag.metadata); |
213 } | 213 } |
214 | 214 |
215 void main() { | 215 void main() { |
216 testClassMetadata(); | 216 testClassMetadata(); |
217 testTopLevelMethodMetadata(); | 217 testTopLevelMethodMetadata(); |
218 testTopLevelFieldMetadata(); | 218 testTopLevelFieldMetadata(); |
219 testLibraryTags(); | 219 testLibraryTags(); |
220 } | 220 } |
OLD | NEW |