| 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, |
| 11 // we need to: | 11 // we need to: |
| 12 // - add a fasta flag to configure the platform library location. | 12 // - add a fasta flag to configure the platform library location. |
| 13 // - add a fasta flag to specify which sdk libraries should be built-in | 13 // - add a fasta flag to specify which sdk libraries should be built-in |
| 14 // (that would replace `loadExtraRequiredLibraries`). | 14 // (that would replace `loadExtraRequiredLibraries`). |
| 15 // - add flags to fasta to turn on various transformations. | 15 // - add flags to fasta to turn on various transformations. |
| 16 // - get rid of `native` in dart2js patches or unify the syntax with the VM. | 16 // - get rid of `native` in dart2js patches or unify the syntax with the VM. |
| 17 | 17 |
| 18 import 'dart:async' show Future; | 18 import 'dart:async' show Future; |
| 19 import 'dart:io' show exitCode; | 19 import 'dart:io' show exitCode; |
| 20 | 20 |
| 21 import 'package:front_end/physical_file_system.dart'; | 21 import 'package:front_end/physical_file_system.dart'; |
| 22 import 'package:front_end/src/fasta/kernel/utils.dart'; | 22 import 'package:front_end/src/fasta/kernel/utils.dart'; |
| 23 import 'package:kernel/ast.dart' show Source; | 23 import 'package:kernel/ast.dart' show Source; |
| 24 | 24 |
| 25 import 'package:front_end/src/fasta/builder/library_builder.dart' |
| 26 show LibraryBuilder; |
| 25 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext; | 27 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext; |
| 26 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; | 28 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; |
| 27 import 'package:front_end/src/fasta/fasta.dart' show CompileTask; | 29 import 'package:front_end/src/fasta/fasta.dart' show CompileTask; |
| 28 import 'package:front_end/src/fasta/kernel/kernel_target.dart' | 30 import 'package:front_end/src/fasta/kernel/kernel_target.dart' |
| 29 show KernelTarget; | 31 show KernelTarget; |
| 30 import 'package:front_end/src/fasta/loader.dart' show Loader; | 32 import 'package:front_end/src/fasta/loader.dart' show Loader; |
| 31 import 'package:front_end/src/fasta/parser/parser.dart' show optional; | 33 import 'package:front_end/src/fasta/parser/parser.dart' show optional; |
| 32 import 'package:front_end/src/scanner/token.dart' show Token; | 34 import 'package:front_end/src/scanner/token.dart' show Token; |
| 33 import 'package:front_end/src/fasta/ticker.dart' show Ticker; | 35 import 'package:front_end/src/fasta/ticker.dart' show Ticker; |
| 34 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; | 36 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; |
| 35 | 37 |
| 38 import 'package:compiler/src/native/native.dart' show maybeEnableNative; |
| 39 |
| 36 /// Generates a platform.dill file containing the compiled Kernel IR of the | 40 /// Generates a platform.dill file containing the compiled Kernel IR of the |
| 37 /// dart2js SDK. | 41 /// dart2js SDK. |
| 38 Future compilePlatform(Uri patchedSdk, Uri fullOutput, | 42 Future compilePlatform(Uri patchedSdk, Uri fullOutput, |
| 39 {Uri outlineOutput, Uri packages}) async { | 43 {Uri outlineOutput, Uri packages}) async { |
| 40 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d")); | 44 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d")); |
| 41 TranslateUri uriTranslator = await TranslateUri | 45 TranslateUri uriTranslator = await TranslateUri |
| 42 .parse(PhysicalFileSystem.instance, patchedSdk, packages: packages); | 46 .parse(PhysicalFileSystem.instance, patchedSdk, packages: packages); |
| 43 var ticker = new Ticker(isVerbose: false); | 47 var ticker = new Ticker(isVerbose: false); |
| 44 var dillTarget = new DillTargetForDart2js(ticker, uriTranslator); | 48 var dillTarget = new DillTargetForDart2js(ticker, uriTranslator); |
| 45 var kernelTarget = | 49 var kernelTarget = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 /// are run, JS-specific libraries are included in the SDK, and native clauses | 84 /// are run, JS-specific libraries are included in the SDK, and native clauses |
| 81 /// have no string parameter. | 85 /// have no string parameter. |
| 82 class KernelTargetForDart2js extends KernelTarget { | 86 class KernelTargetForDart2js extends KernelTarget { |
| 83 KernelTargetForDart2js( | 87 KernelTargetForDart2js( |
| 84 DillTarget target, TranslateUri uriTranslator, bool strongMode, | 88 DillTarget target, TranslateUri uriTranslator, bool strongMode, |
| 85 [Map<String, Source> uriToSource]) | 89 [Map<String, Source> uriToSource]) |
| 86 : super(PhysicalFileSystem.instance, target, uriTranslator, strongMode, | 90 : super(PhysicalFileSystem.instance, target, uriTranslator, strongMode, |
| 87 uriToSource); | 91 uriToSource); |
| 88 | 92 |
| 89 @override | 93 @override |
| 94 bool enableNative(LibraryBuilder library) => maybeEnableNative(library.uri); |
| 95 |
| 96 @override |
| 90 Token skipNativeClause(Token token) => _skipNative(token); | 97 Token skipNativeClause(Token token) => _skipNative(token); |
| 91 | 98 |
| 92 @override | 99 @override |
| 93 String extractNativeMethodName(Token token) => ""; | 100 String extractNativeMethodName(Token token) => ""; |
| 94 | 101 |
| 95 @override | 102 @override |
| 96 void loadExtraRequiredLibraries(Loader loader) => _loadExtras(loader); | 103 void loadExtraRequiredLibraries(Loader loader) => _loadExtras(loader); |
| 97 | 104 |
| 98 @override | 105 @override |
| 99 void runBuildTransformations() {} | 106 void runBuildTransformations() {} |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 'dart:html_common', | 162 'dart:html_common', |
| 156 'dart:indexed_db', | 163 'dart:indexed_db', |
| 157 'dart:js', | 164 'dart:js', |
| 158 'dart:js_util', | 165 'dart:js_util', |
| 159 'dart:mirrors', | 166 'dart:mirrors', |
| 160 'dart:svg', | 167 'dart:svg', |
| 161 'dart:web_audio', | 168 'dart:web_audio', |
| 162 'dart:web_gl', | 169 'dart:web_gl', |
| 163 'dart:web_sql', | 170 'dart:web_sql', |
| 164 ]; | 171 ]; |
| OLD | NEW |