| 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 '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; | 5 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
; |
| 6 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro
r.dart'; |
| 7 | 8 |
| 8 import 'dart:io'; | 9 import 'dart:io'; |
| 9 | 10 |
| 10 int count(Iterable iterable) { | 11 int count(Iterable iterable) { |
| 11 var count = 0; | 12 var count = 0; |
| 12 for (var element in iterable) { | 13 for (var element in iterable) { |
| 13 count++; | 14 count++; |
| 14 } | 15 } |
| 15 return count; | 16 return count; |
| 16 } | 17 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 return null; | 34 return null; |
| 34 } | 35 } |
| 35 | 36 |
| 36 main() { | 37 main() { |
| 37 var scriptPath = new Path(new Options().script); | 38 var scriptPath = new Path(new Options().script); |
| 38 var dirPath = scriptPath.directoryPath; | 39 var dirPath = scriptPath.directoryPath; |
| 39 var libPath = dirPath.join(new Path('../../../sdk/')); | 40 var libPath = dirPath.join(new Path('../../../sdk/')); |
| 40 var inputPath = dirPath.join(new Path('mirrors_helper.dart')); | 41 var inputPath = dirPath.join(new Path('mirrors_helper.dart')); |
| 41 var compilation = new Compilation.library([inputPath], libPath, null, | 42 var result = analyze([inputPath], libPath, |
| 42 <String>['--preserve-comments']); | 43 options: <String>['--preserve-comments']); |
| 43 Expect.isNotNull(compilation, "No compilation created"); | 44 result.then((MirrorSystem mirrors) { |
| 45 test(mirrors); |
| 46 }); |
| 47 } |
| 44 | 48 |
| 45 var mirrors = compilation.mirrors; | 49 void test(MirrorSystem mirrors) { |
| 46 Expect.isNotNull(mirrors, "No mirror system returned from compilation"); | 50 Expect.isNotNull(mirrors, "No mirror system returned from compilation"); |
| 47 | 51 |
| 48 var libraries = mirrors.libraries; | 52 var libraries = mirrors.libraries; |
| 49 Expect.isNotNull(libraries, "No libraries map returned"); | 53 Expect.isNotNull(libraries, "No libraries map returned"); |
| 50 Expect.isFalse(libraries.isEmpty, "Empty libraries map returned"); | 54 Expect.isFalse(libraries.isEmpty, "Empty libraries map returned"); |
| 51 | 55 |
| 52 var helperLibrary = libraries["mirrors_helper"]; | 56 var helperLibrary = libraries["mirrors_helper"]; |
| 53 Expect.isNotNull(helperLibrary, "Library 'mirrors_helper' not found"); | 57 Expect.isNotNull(helperLibrary, "Library 'mirrors_helper' not found"); |
| 54 Expect.stringEquals("mirrors_helper", helperLibrary.simpleName, | 58 Expect.stringEquals("mirrors_helper", helperLibrary.simpleName, |
| 55 "Unexpected library simple name"); | 59 "Unexpected library simple name"); |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 Expect.isTrue(privateFactoryConstructor.isPrivate); | 1046 Expect.isTrue(privateFactoryConstructor.isPrivate); |
| 1043 Expect.isFalse(privateFactoryConstructor.isConstConstructor); | 1047 Expect.isFalse(privateFactoryConstructor.isConstConstructor); |
| 1044 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); | 1048 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); |
| 1045 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); | 1049 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); |
| 1046 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); | 1050 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); |
| 1047 | 1051 |
| 1048 var metadata = privateClass.metadata; | 1052 var metadata = privateClass.metadata; |
| 1049 Expect.isNotNull(metadata); | 1053 Expect.isNotNull(metadata); |
| 1050 Expect.equals(0, metadata.length); | 1054 Expect.equals(0, metadata.length); |
| 1051 } | 1055 } |
| OLD | NEW |