| 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 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
| 7 import 'parser_helper.dart'; | 7 import 'parser_helper.dart'; |
| 8 | 8 |
| 9 void checkPosition(Spannable spannable, Node node, String source, compiler) { | 9 void checkPosition(Spannable spannable, Node node, String source, compiler) { |
| 10 SourceSpan span = compiler.spanFromSpannable(spannable); | 10 SourceSpan span = compiler.spanFromSpannable(spannable); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 void testTopLevelFieldMetadata() { | 138 void testTopLevelFieldMetadata() { |
| 139 checkAnnotation('foo', 'var foo;'); | 139 checkAnnotation('foo', 'var foo;'); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void testLibraryTags() { | 142 void testLibraryTags() { |
| 143 void compileAndCheckLibrary( | 143 void compileAndCheckLibrary( |
| 144 String source, | 144 String source, |
| 145 Link<MetadataAnnotation> extractMetadata(LibraryElement element)) { | 145 Link<MetadataAnnotation> extractMetadata(LibraryElement element)) { |
| 146 Uri partUri = new Uri.fromComponents(scheme: 'source', path: 'part.dart'); | 146 Uri partUri = new Uri(scheme: 'source', path: 'part.dart'); |
| 147 String partSource = '@native part of foo;'; | 147 String partSource = '@native part of foo;'; |
| 148 | 148 |
| 149 Uri libUri = new Uri.fromComponents(scheme: 'source', path: 'lib.dart'); | 149 Uri libUri = new Uri(scheme: 'source', path: 'lib.dart'); |
| 150 String libSource = 'library lib;'; | 150 String libSource = 'library lib;'; |
| 151 | 151 |
| 152 Uri uri = new Uri.fromComponents(scheme: 'source', path: 'main.dart'); | 152 Uri uri = new Uri(scheme: 'source', path: 'main.dart'); |
| 153 | 153 |
| 154 Uri async = new Uri.fromComponents(scheme: 'dart', path: 'async'); | 154 Uri async = new Uri(scheme: 'dart', path: 'async'); |
| 155 | 155 |
| 156 var compiler = compilerFor(source, uri) | 156 var compiler = compilerFor(source, uri) |
| 157 ..registerSource(partUri, partSource) | 157 ..registerSource(partUri, partSource) |
| 158 ..registerSource(libUri, libSource) | 158 ..registerSource(libUri, libSource) |
| 159 ..registerSource(async, 'class DeferredLibrary {}') | 159 ..registerSource(async, 'class DeferredLibrary {}') |
| 160 ..runCompiler(uri); | 160 ..runCompiler(uri); |
| 161 compiler.enqueuer.resolution.queueIsClosed = false; | 161 compiler.enqueuer.resolution.queueIsClosed = false; |
| 162 LibraryElement element = compiler.libraries['$uri']; | 162 LibraryElement element = compiler.libraries['$uri']; |
| 163 Expect.isNotNull(element, 'Cannot find $uri'); | 163 Expect.isNotNull(element, 'Cannot find $uri'); |
| 164 | 164 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 compileAndCheckLibrary(source, | 206 compileAndCheckLibrary(source, |
| 207 (e) => e.compilationUnits.first.partTag.metadata); | 207 (e) => e.compilationUnits.first.partTag.metadata); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void main() { | 210 void main() { |
| 211 testClassMetadata(); | 211 testClassMetadata(); |
| 212 testTopLevelMethodMetadata(); | 212 testTopLevelMethodMetadata(); |
| 213 testTopLevelFieldMetadata(); | 213 testTopLevelFieldMetadata(); |
| 214 testLibraryTags(); | 214 testLibraryTags(); |
| 215 } | 215 } |
| OLD | NEW |