OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// Additions to Fasta for generating .dill (Kernel IR) files with dart2js patch | 5 /// Additions to Fasta for generating .dill (Kernel IR) files with dart2js patch |
6 /// files and native hooks. | 6 /// files and native hooks. |
7 library compiler.src.kernel.fasta_support; | 7 library compiler.src.kernel.fasta_support; |
8 | 8 |
9 // TODO(sigmund): get rid of this file. Fasta should be agnostic of the | 9 // TODO(sigmund): get rid of this file. Fasta should be agnostic of the |
10 // target platform, at which point this should not be necessary. In particular, | 10 // target platform, at which point this should not be necessary. In particular, |
(...skipping 16 matching lines...) Expand all Loading... |
27 import 'package:front_end/src/fasta/kernel/kernel_target.dart' | 27 import 'package:front_end/src/fasta/kernel/kernel_target.dart' |
28 show KernelTarget; | 28 show KernelTarget; |
29 import 'package:front_end/src/fasta/loader.dart' show Loader; | 29 import 'package:front_end/src/fasta/loader.dart' show Loader; |
30 import 'package:front_end/src/fasta/parser/parser.dart' show optional; | 30 import 'package:front_end/src/fasta/parser/parser.dart' show optional; |
31 import 'package:front_end/src/fasta/scanner/token.dart' show Token; | 31 import 'package:front_end/src/fasta/scanner/token.dart' show Token; |
32 import 'package:front_end/src/fasta/ticker.dart' show Ticker; | 32 import 'package:front_end/src/fasta/ticker.dart' show Ticker; |
33 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; | 33 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; |
34 | 34 |
35 /// Generates a platform.dill file containing the compiled Kernel IR of the | 35 /// Generates a platform.dill file containing the compiled Kernel IR of the |
36 /// dart2js SDK. | 36 /// dart2js SDK. |
37 Future compilePlatform(Uri patchedSdk, Uri output, {Uri packages}) async { | 37 Future compilePlatform(Uri patchedSdk, Uri fullOutput, |
38 Uri deps = Uri.base.resolveUri(new Uri.file("${output.toFilePath()}.d")); | 38 {Uri outlineOutput, Uri packages}) async { |
| 39 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d")); |
39 TranslateUri uriTranslator = await TranslateUri.parse( | 40 TranslateUri uriTranslator = await TranslateUri.parse( |
40 PhysicalFileSystem.instance, patchedSdk, packages); | 41 PhysicalFileSystem.instance, patchedSdk, packages); |
41 var ticker = new Ticker(isVerbose: false); | 42 var ticker = new Ticker(isVerbose: false); |
42 var dillTarget = new DillTargetForDart2js(ticker, uriTranslator); | 43 var dillTarget = new DillTargetForDart2js(ticker, uriTranslator); |
43 var kernelTarget = | 44 var kernelTarget = |
44 new KernelTargetForDart2js(dillTarget, uriTranslator, false); | 45 new KernelTargetForDart2js(dillTarget, uriTranslator, false); |
45 | 46 |
46 kernelTarget.read(Uri.parse("dart:core")); | 47 kernelTarget.read(Uri.parse("dart:core")); |
47 await dillTarget.writeOutline(null); | 48 await dillTarget.writeOutline(null); |
48 await kernelTarget.writeOutline(output); | 49 await kernelTarget.writeOutline(outlineOutput); |
49 | 50 |
50 if (exitCode != 0) return null; | 51 if (exitCode != 0) return null; |
51 await kernelTarget.writeProgram(output); | 52 await kernelTarget.writeProgram(fullOutput); |
52 await kernelTarget.writeDepsFile(output, deps); | 53 await kernelTarget.writeDepsFile(fullOutput, deps); |
53 } | 54 } |
54 | 55 |
55 /// Extends the internal fasta [CompileTask] to use a dart2js-aware [DillTarget] | 56 /// Extends the internal fasta [CompileTask] to use a dart2js-aware [DillTarget] |
56 /// and [KernelTarget]. | 57 /// and [KernelTarget]. |
57 class Dart2jsCompileTask extends CompileTask { | 58 class Dart2jsCompileTask extends CompileTask { |
58 Dart2jsCompileTask(CompilerContext c, Ticker ticker) : super(c, ticker); | 59 Dart2jsCompileTask(CompilerContext c, Ticker ticker) : super(c, ticker); |
59 | 60 |
60 @override | 61 @override |
61 DillTarget createDillTarget(TranslateUri uriTranslator) { | 62 DillTarget createDillTarget(TranslateUri uriTranslator) { |
62 return new DillTargetForDart2js(ticker, uriTranslator); | 63 return new DillTargetForDart2js(ticker, uriTranslator); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 'dart:_native_typed_data', | 143 'dart:_native_typed_data', |
143 'dart:_internal', | 144 'dart:_internal', |
144 'dart:_js_helper', | 145 'dart:_js_helper', |
145 'dart:_interceptors', | 146 'dart:_interceptors', |
146 'dart:_foreign_helper', | 147 'dart:_foreign_helper', |
147 'dart:_js_mirrors', | 148 'dart:_js_mirrors', |
148 'dart:_js_names', | 149 'dart:_js_names', |
149 'dart:_js_embedded_names', | 150 'dart:_js_embedded_names', |
150 'dart:_isolate_helper', | 151 'dart:_isolate_helper', |
151 ]; | 152 ]; |
OLD | NEW |