OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Alternative compile method for dart2js commandline that stores the compiler | 5 /// Alternative compile method for dart2js commandline that stores the compiler |
6 /// for later inspection. | 6 /// for later inspection. |
7 /// | 7 /// |
8 /// Use this in testing to inspect the compiler after compilation by setting | 8 /// Use this in testing to inspect the compiler after compilation by setting |
9 /// the `compileFunc` variable in `package:compiler/src/dart2js.dart` | 9 /// the `compileFunc` variable in `package:compiler/implementation/dart2js.dart` |
10 /// to [compiler] before calling the `internalMain` function. | 10 /// to [compiler] before calling the `internalMain` function. |
11 | 11 |
12 library dart2js.alt; | 12 library dart2js.alt; |
13 | 13 |
14 import 'dart:async'; | 14 import 'dart:async'; |
15 import 'package:compiler/compiler.dart'; | 15 import 'package:compiler/compiler.dart'; |
16 import 'package:compiler/src/apiimpl.dart'; | 16 import 'package:compiler/implementation/apiimpl.dart'; |
17 | 17 |
18 Compiler compiler; | 18 Compiler compiler; |
19 | 19 |
20 Future<String> compile(Uri script, | 20 Future<String> compile(Uri script, |
21 Uri libraryRoot, | 21 Uri libraryRoot, |
22 Uri packageRoot, | 22 Uri packageRoot, |
23 CompilerInputProvider inputProvider, | 23 CompilerInputProvider inputProvider, |
24 DiagnosticHandler handler, | 24 DiagnosticHandler handler, |
25 [List<String> options = const [], | 25 [List<String> options = const [], |
26 CompilerOutputProvider outputProvider, | 26 CompilerOutputProvider outputProvider, |
(...skipping 12 matching lines...) Expand all Loading... |
39 options, | 39 options, |
40 environment); | 40 environment); |
41 return compiler.run(script).then((_) { | 41 return compiler.run(script).then((_) { |
42 String code = compiler.assembledCode; | 42 String code = compiler.assembledCode; |
43 if (code != null && outputProvider != null) { | 43 if (code != null && outputProvider != null) { |
44 code = ''; // Non-null signals success. | 44 code = ''; // Non-null signals success. |
45 } | 45 } |
46 return code; | 46 return code; |
47 }); | 47 }); |
48 } | 48 } |
OLD | NEW |