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 '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; | 7 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; |
8 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; |
9 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro
r.dart'; | 9 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro
r.dart'; |
10 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart' |
11 show currentDirectory, nativeToUriPath; | 11 show currentDirectory; |
12 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; | 12 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; |
13 | 13 |
14 import 'dart:io'; | 14 import 'dart:io'; |
15 | 15 |
16 final Uri DART_MIRRORS_URI = new Uri(scheme: 'dart', path: 'mirrors'); | 16 final Uri DART_MIRRORS_URI = new Uri(scheme: 'dart', path: 'mirrors'); |
17 | 17 |
18 int count(Iterable iterable) { | 18 int count(Iterable iterable) { |
19 var count = 0; | 19 var count = 0; |
20 for (var element in iterable) { | 20 for (var element in iterable) { |
21 count++; | 21 count++; |
(...skipping 13 matching lines...) Expand all Loading... |
35 DeclarationMirror findMirror(Iterable<DeclarationMirror> list, String name) { | 35 DeclarationMirror findMirror(Iterable<DeclarationMirror> list, String name) { |
36 for (DeclarationMirror mirror in list) { | 36 for (DeclarationMirror mirror in list) { |
37 if (mirror.simpleName == name) { | 37 if (mirror.simpleName == name) { |
38 return mirror; | 38 return mirror; |
39 } | 39 } |
40 } | 40 } |
41 return null; | 41 return null; |
42 } | 42 } |
43 | 43 |
44 main() { | 44 main() { |
45 Uri scriptUri = | 45 Uri scriptUri = currentDirectory.resolveUri(Platform.script); |
46 currentDirectory.resolve(nativeToUriPath(Platform.script)); | |
47 Uri libUri = scriptUri.resolve('../../../sdk/'); | 46 Uri libUri = scriptUri.resolve('../../../sdk/'); |
48 Uri inputUri = scriptUri.resolve('mirrors_helper.dart'); | 47 Uri inputUri = scriptUri.resolve('mirrors_helper.dart'); |
49 var provider = new CompilerSourceFileProvider(); | 48 var provider = new CompilerSourceFileProvider(); |
50 var diagnosticHandler = | 49 var diagnosticHandler = |
51 new FormattingDiagnosticHandler(provider).diagnosticHandler; | 50 new FormattingDiagnosticHandler(provider).diagnosticHandler; |
52 asyncStart(); | 51 asyncStart(); |
53 var result = analyze([inputUri], libUri, null, | 52 var result = analyze([inputUri], libUri, null, |
54 provider.readStringFromUri, diagnosticHandler, | 53 provider.readStringFromUri, diagnosticHandler, |
55 <String>['--preserve-comments']); | 54 <String>['--preserve-comments']); |
56 result.then((MirrorSystem mirrors) { | 55 result.then((MirrorSystem mirrors) { |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 Expect.isTrue(privateFactoryConstructor.isPrivate); | 1025 Expect.isTrue(privateFactoryConstructor.isPrivate); |
1027 Expect.isFalse(privateFactoryConstructor.isConstConstructor); | 1026 Expect.isFalse(privateFactoryConstructor.isConstConstructor); |
1028 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); | 1027 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); |
1029 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); | 1028 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); |
1030 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); | 1029 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); |
1031 | 1030 |
1032 var metadata = privateClass.metadata; | 1031 var metadata = privateClass.metadata; |
1033 Expect.isNotNull(metadata); | 1032 Expect.isNotNull(metadata); |
1034 Expect.equals(0, metadata.length); | 1033 Expect.equals(0, metadata.length); |
1035 } | 1034 } |
OLD | NEW |