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

Side by Side Diff: pkg/front_end/lib/src/fasta/target_implementation.dart

Issue 2979463002: Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service." (Closed)
Patch Set: Created 3 years, 5 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.target_implementation; 5 library fasta.target_implementation;
6 6
7 import 'package:kernel/target/targets.dart' as backend show Target; 7 import 'package:kernel/target/targets.dart' as backend show Target;
8 8
9 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder; 9 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder;
10 10
11 import 'parser/dart_vm_native.dart' as vm show skipNativeClause;
12
13 import '../scanner/token.dart' show Token;
14
11 import 'loader.dart' show Loader; 15 import 'loader.dart' show Loader;
12 16
17 import 'quote.dart' show unescapeString;
18
13 import 'target.dart' show Target; 19 import 'target.dart' show Target;
14 20
15 import 'ticker.dart' show Ticker; 21 import 'ticker.dart' show Ticker;
16 22
17 import 'translate_uri.dart' show TranslateUri; 23 import 'translate_uri.dart' show TranslateUri;
18 24
19 /// Provides the implementation details used by a loader for a target. 25 /// Provides the implementation details used by a loader for a target.
20 abstract class TargetImplementation extends Target { 26 abstract class TargetImplementation extends Target {
21 final TranslateUri uriTranslator; 27 final TranslateUri uriTranslator;
22 28
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1); 95 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1);
90 return cachedNativeAnnotation = internal.getConstructor("ExternalName"); 96 return cachedNativeAnnotation = internal.getConstructor("ExternalName");
91 } 97 }
92 98
93 void loadExtraRequiredLibraries(Loader loader) { 99 void loadExtraRequiredLibraries(Loader loader) {
94 for (String uri in backendTarget.extraRequiredLibraries) { 100 for (String uri in backendTarget.extraRequiredLibraries) {
95 loader.read(Uri.parse(uri), -1); 101 loader.read(Uri.parse(uri), -1);
96 } 102 }
97 } 103 }
98 104
105 /// Whether the `native` language extension is supported within [library].
106 ///
107 /// The `native` language extension is not part of the language specification,
108 /// means something else to each target, and is enabled differently for each
109 /// target implementation. For example, the VM target enables it everywhere
110 /// because of existing support for "dart-ext:" native extensions, but targets
111 /// like dart2js only enable it on the core libraries.
112 ///
113 /// This default implementation assumes a VM target, but it can be overriden
114 /// in subclasses to change the behavior.
115 // TODO(sigmund,ahe): limit this to `dart-ext` libraries only (see
116 // https://github.com/dart-lang/sdk/issues/29763).
117 bool enableNative(LibraryBuilder library) => true;
118
119 Token skipNativeClause(Token token) => vm.skipNativeClause(token);
120
121 String extractNativeMethodName(Token token) =>
122 unescapeString(token.next.lexeme);
123
99 void addSourceInformation( 124 void addSourceInformation(
100 Uri uri, List<int> lineStarts, List<int> sourceCode); 125 Uri uri, List<int> lineStarts, List<int> sourceCode);
101 126
102 void readPatchFiles(LibraryBuilder library) { 127 void readPatchFiles(LibraryBuilder library) {
103 assert(library.uri.scheme == "dart"); 128 assert(library.uri.scheme == "dart");
104 List<Uri> patches = uriTranslator.patches[library.uri.path]; 129 List<Uri> patches = uriTranslator.patches[library.uri.path];
105 if (patches != null) { 130 if (patches != null) {
106 for (Uri patch in patches) { 131 for (Uri patch in patches) {
107 library.loader.read(patch, -1, fileUri: patch, isPatch: true); 132 library.loader.read(patch, -1, fileUri: patch, isPatch: true);
108 } 133 }
109 } 134 }
110 } 135 }
111 } 136 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/source/source_loader.dart ('k') | pkg/front_end/lib/src/fasta/testing/kernel_chain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698