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 library dart2js.source_mirrors.analyze; | 5 library dart2js.source_mirrors.analyze; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'source_mirrors.dart'; | 9 import 'source_mirrors.dart'; |
10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; | 10 import 'dart2js_mirrors.dart' show Dart2JsMirrorSystem; |
11 import '../../compiler.dart' as api; | 11 import '../../compiler.dart' as api; |
12 import '../../compiler_new.dart' as new_api; | 12 import '../options.dart' show CompilerOptions; |
13 import '../apiimpl.dart' as apiimpl; | 13 import '../apiimpl.dart' as apiimpl; |
14 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
15 import '../old_to_new_api.dart'; | 15 import '../old_to_new_api.dart'; |
16 | 16 |
17 //------------------------------------------------------------------------------ | 17 //------------------------------------------------------------------------------ |
18 // Analysis entry point. | 18 // Analysis entry point. |
19 //------------------------------------------------------------------------------ | 19 //------------------------------------------------------------------------------ |
20 | 20 |
21 /** | 21 /** |
22 * Analyzes set of libraries and provides a mirror system which can be used for | 22 * Analyzes set of libraries and provides a mirror system which can be used for |
(...skipping 29 matching lines...) Expand all Loading... |
52 kind == api.Diagnostic.CRASH) { | 52 kind == api.Diagnostic.CRASH) { |
53 compilationFailed = true; | 53 compilationFailed = true; |
54 } | 54 } |
55 diagnosticHandler(uri, begin, end, message, kind); | 55 diagnosticHandler(uri, begin, end, message, kind); |
56 } | 56 } |
57 | 57 |
58 Compiler compiler = new apiimpl.CompilerImpl( | 58 Compiler compiler = new apiimpl.CompilerImpl( |
59 new LegacyCompilerInput(inputProvider), | 59 new LegacyCompilerInput(inputProvider), |
60 new LegacyCompilerOutput(), | 60 new LegacyCompilerOutput(), |
61 new LegacyCompilerDiagnostics(internalDiagnosticHandler), | 61 new LegacyCompilerDiagnostics(internalDiagnosticHandler), |
62 new new_api.CompilerOptions.parse( | 62 new CompilerOptions.parse( |
63 libraryRoot: libraryRoot, | 63 libraryRoot: libraryRoot, |
64 packageRoot: packageRoot, | 64 packageRoot: packageRoot, |
65 options: options, | 65 options: options, |
66 environment: const {}, | 66 environment: const {}, |
67 packageConfig: packageConfig, | 67 packageConfig: packageConfig, |
68 packagesDiscoveryProvider: findPackages)); | 68 packagesDiscoveryProvider: findPackages)); |
69 compiler.librariesToAnalyzeWhenRun = libraries; | 69 compiler.librariesToAnalyzeWhenRun = libraries; |
70 return compiler.run(null).then((bool success) { | 70 return compiler.run(null).then((bool success) { |
71 if (success && !compilationFailed) { | 71 if (success && !compilationFailed) { |
72 return new Dart2JsMirrorSystem(compiler); | 72 return new Dart2JsMirrorSystem(compiler); |
73 } else { | 73 } else { |
74 throw new StateError('Failed to create mirror system.'); | 74 throw new StateError('Failed to create mirror system.'); |
75 } | 75 } |
76 }); | 76 }); |
77 } | 77 } |
OLD | NEW |