| 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 'parser_helper.dart'; | 10 import 'parser_helper.dart'; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 String source, | 147 String source, |
| 148 Link<MetadataAnnotation> extractMetadata(LibraryElement element)) { | 148 Link<MetadataAnnotation> extractMetadata(LibraryElement element)) { |
| 149 Uri partUri = new Uri(scheme: 'source', path: 'part.dart'); | 149 Uri partUri = new Uri(scheme: 'source', path: 'part.dart'); |
| 150 String partSource = '@native part of foo;'; | 150 String partSource = '@native part of foo;'; |
| 151 | 151 |
| 152 Uri libUri = new Uri(scheme: 'source', path: 'lib.dart'); | 152 Uri libUri = new Uri(scheme: 'source', path: 'lib.dart'); |
| 153 String libSource = 'library lib;'; | 153 String libSource = 'library lib;'; |
| 154 | 154 |
| 155 Uri uri = new Uri(scheme: 'source', path: 'main.dart'); | 155 Uri uri = new Uri(scheme: 'source', path: 'main.dart'); |
| 156 | 156 |
| 157 Uri async = new Uri(scheme: 'dart', path: 'async'); | |
| 158 | |
| 159 var compiler = compilerFor(source, uri) | 157 var compiler = compilerFor(source, uri) |
| 160 ..registerSource(partUri, partSource) | 158 ..registerSource(partUri, partSource) |
| 161 ..registerSource(libUri, libSource) | 159 ..registerSource(libUri, libSource); |
| 162 ..registerSource(async, 'class DeferredLibrary {}'); | |
| 163 | 160 |
| 164 asyncTest(() => compiler.runCompiler(uri).then((_) { | 161 asyncTest(() => compiler.runCompiler(uri).then((_) { |
| 165 compiler.enqueuer.resolution.queueIsClosed = false; | 162 compiler.enqueuer.resolution.queueIsClosed = false; |
| 166 LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); | 163 LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); |
| 167 Expect.isNotNull(element, 'Cannot find $uri'); | 164 Expect.isNotNull(element, 'Cannot find $uri'); |
| 168 | 165 |
| 169 Link<MetadataAnnotation> metadata = extractMetadata(element); | 166 Link<MetadataAnnotation> metadata = extractMetadata(element); |
| 170 Expect.equals(1, length(metadata)); | 167 Expect.equals(1, length(metadata)); |
| 171 | 168 |
| 172 PartialMetadataAnnotation annotation = metadata.head; | 169 PartialMetadataAnnotation annotation = metadata.head; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 compileAndCheckLibrary(source, | 208 compileAndCheckLibrary(source, |
| 212 (e) => e.compilationUnits.first.partTag.metadata); | 209 (e) => e.compilationUnits.first.partTag.metadata); |
| 213 } | 210 } |
| 214 | 211 |
| 215 void main() { | 212 void main() { |
| 216 testClassMetadata(); | 213 testClassMetadata(); |
| 217 testTopLevelMethodMetadata(); | 214 testTopLevelMethodMetadata(); |
| 218 testTopLevelFieldMetadata(); | 215 testTopLevelFieldMetadata(); |
| 219 testLibraryTags(); | 216 testLibraryTags(); |
| 220 } | 217 } |
| OLD | NEW |