OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import 'dart:io'; | |
6 import 'dart:async'; | |
7 | |
8 import 'package:compiler/src/mirrors/source_mirrors.dart'; | |
9 import 'package:compiler/src/mirrors/analyze.dart' as source_mirrors; | |
10 import 'package:compiler/src/source_file_provider.dart'; | |
11 | |
12 TypeMirror createInstantiation(TypeSourceMirror type, | |
13 List<TypeMirror> typeArguments) { | |
14 return type.createInstantiation(typeArguments); | |
15 } | |
16 | |
17 Future<MirrorSystem> analyze(String test) { | |
18 Uri repository = Platform.script.resolve('../../../../'); | |
19 Uri testUri = repository.resolve('tests/lib/mirrors/$test'); | |
20 return analyzeUri(testUri); | |
21 } | |
22 | |
23 | |
24 Future<MirrorSystem> analyzeUri(Uri testUri) { | |
25 Uri repository = Platform.script.resolve('../../../../'); | |
26 Uri libraryRoot = repository.resolve('sdk/'); | |
27 Uri packageRoot = Uri.base.resolve(Platform.packageRoot); | |
28 var provider = new CompilerSourceFileProvider(); | |
29 var handler = new FormattingDiagnosticHandler(provider); | |
30 return source_mirrors.analyze( | |
31 [testUri], | |
32 libraryRoot, | |
33 packageRoot, | |
34 provider, | |
35 handler); | |
36 } | |
OLD | NEW |