Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: pkg/compiler/lib/src/kernel/fasta_support.dart

Issue 2913013003: Move enableNative to target, turn it on by default (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
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/compiler_context.dart' show CompilerContext; 25 import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
26 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget; 26 import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
27 import 'package:front_end/src/fasta/fasta.dart' show CompileTask; 27 import 'package:front_end/src/fasta/fasta.dart' show CompileTask;
28 import 'package:front_end/src/fasta/kernel/kernel_target.dart' 28 import 'package:front_end/src/fasta/kernel/kernel_target.dart'
29 show KernelTarget; 29 show KernelTarget;
30 import 'package:front_end/src/fasta/loader.dart' show Loader; 30 import 'package:front_end/src/fasta/loader.dart' show Loader;
31 import 'package:front_end/src/fasta/parser/parser.dart' show optional; 31 import 'package:front_end/src/fasta/parser/parser.dart' show optional;
32 import 'package:front_end/src/fasta/source/source_library_builder.dart'
33 show SourceLibraryBuilder;
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
36 /// Generates a platform.dill file containing the compiled Kernel IR of the 38 /// Generates a platform.dill file containing the compiled Kernel IR of the
37 /// dart2js SDK. 39 /// dart2js SDK.
38 Future compilePlatform(Uri patchedSdk, Uri fullOutput, 40 Future compilePlatform(Uri patchedSdk, Uri fullOutput,
39 {Uri outlineOutput, Uri packages}) async { 41 {Uri outlineOutput, Uri packages}) async {
40 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d")); 42 Uri deps = Uri.base.resolveUri(new Uri.file("${fullOutput.toFilePath()}.d"));
41 TranslateUri uriTranslator = await TranslateUri 43 TranslateUri uriTranslator = await TranslateUri
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 /// are run, JS-specific libraries are included in the SDK, and native clauses 82 /// are run, JS-specific libraries are included in the SDK, and native clauses
81 /// have no string parameter. 83 /// have no string parameter.
82 class KernelTargetForDart2js extends KernelTarget { 84 class KernelTargetForDart2js extends KernelTarget {
83 KernelTargetForDart2js( 85 KernelTargetForDart2js(
84 DillTarget target, TranslateUri uriTranslator, bool strongMode, 86 DillTarget target, TranslateUri uriTranslator, bool strongMode,
85 [Map<String, Source> uriToSource]) 87 [Map<String, Source> uriToSource])
86 : super(PhysicalFileSystem.instance, target, uriTranslator, strongMode, 88 : super(PhysicalFileSystem.instance, target, uriTranslator, strongMode,
87 uriToSource); 89 uriToSource);
88 90
89 @override 91 @override
92 bool enableNative(SourceLibraryBuilder library) =>
93 library.uri.scheme == "dart" || library.isPatch;
94
95 @override
90 Token skipNativeClause(Token token) => _skipNative(token); 96 Token skipNativeClause(Token token) => _skipNative(token);
91 97
92 @override 98 @override
93 String extractNativeMethodName(Token token) => null; 99 String extractNativeMethodName(Token token) => null;
94 100
95 @override 101 @override
96 void loadExtraRequiredLibraries(Loader loader) => _loadExtras(loader); 102 void loadExtraRequiredLibraries(Loader loader) => _loadExtras(loader);
97 103
98 @override 104 @override
99 void runBuildTransformations() {} 105 void runBuildTransformations() {}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 'dart:html_common', 161 'dart:html_common',
156 'dart:indexed_db', 162 'dart:indexed_db',
157 'dart:js', 163 'dart:js',
158 'dart:js_util', 164 'dart:js_util',
159 'dart:mirrors', 165 'dart:mirrors',
160 'dart:svg', 166 'dart:svg',
161 'dart:web_audio', 167 'dart:web_audio',
162 'dart:web_gl', 168 'dart:web_gl',
163 'dart:web_sql', 169 'dart:web_sql',
164 ]; 170 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698