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

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

Issue 2832353002: Add support for building patched_sdk and platform.dill for dart2js: (Closed)
Patch Set: rebase Created 3 years, 8 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 kernel show Target;
8
7 import 'package:kernel/target/vm.dart' show VmTarget; 9 import 'package:kernel/target/vm.dart' show VmTarget;
8 10
11 import 'package:kernel/target/dart2js.dart' show Dart2jsTarget;
12
9 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder; 13 import 'builder/builder.dart' show Builder, ClassBuilder, LibraryBuilder;
10 14
11 import 'loader.dart' show Loader; 15 import 'loader.dart' show Loader;
12 16
13 import 'target.dart' show Target; 17 import 'target.dart' show Target;
14 18
15 import 'ticker.dart' show Ticker; 19 import 'ticker.dart' show Ticker;
16 20
17 import 'translate_uri.dart' show TranslateUri; 21 import 'translate_uri.dart' show TranslateUri;
18 22
19 /// Provides the implementation details used by a loader for a target. 23 /// Provides the implementation details used by a loader for a target.
20 abstract class TargetImplementation extends Target { 24 abstract class TargetImplementation extends Target {
21 final TranslateUri uriTranslator; 25 final TranslateUri uriTranslator;
22 Builder cachedCompileTimeError; 26 Builder cachedCompileTimeError;
23 Builder cachedAbstractClassInstantiationError; 27 Builder cachedAbstractClassInstantiationError;
24 Builder cachedNativeAnnotation; 28 Builder cachedNativeAnnotation;
25 29
26 TargetImplementation(Ticker ticker, this.uriTranslator) : super(ticker); 30 TargetImplementation(Ticker ticker, this.uriTranslator, bool forDart2js)
31 : super(ticker, forDart2js);
27 32
28 /// Creates a [LibraryBuilder] corresponding to [uri], if one doesn't exist 33 /// Creates a [LibraryBuilder] corresponding to [uri], if one doesn't exist
29 /// already. 34 /// already.
30 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri); 35 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri);
31 36
32 /// Add the classes extended or implemented directly by [cls] to [set]. 37 /// Add the classes extended or implemented directly by [cls] to [set].
33 void addDirectSupertype(ClassBuilder cls, Set<ClassBuilder> set); 38 void addDirectSupertype(ClassBuilder cls, Set<ClassBuilder> set);
34 39
35 /// Returns all classes that will be included in the resulting program. 40 /// Returns all classes that will be included in the resulting program.
36 List<ClassBuilder> collectAllClasses(); 41 List<ClassBuilder> collectAllClasses();
(...skipping 29 matching lines...) Expand all
66 /// Returns a reference to the constructor used for creating `native` 71 /// Returns a reference to the constructor used for creating `native`
67 /// annotations. The constructor is expected to accept a single argument of 72 /// annotations. The constructor is expected to accept a single argument of
68 /// type String, which is the name of the native method. 73 /// type String, which is the name of the native method.
69 Builder getNativeAnnotation(Loader loader) { 74 Builder getNativeAnnotation(Loader loader) {
70 if (cachedNativeAnnotation != null) return cachedNativeAnnotation; 75 if (cachedNativeAnnotation != null) return cachedNativeAnnotation;
71 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal")); 76 LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"));
72 return cachedNativeAnnotation = internal.getConstructor("ExternalName"); 77 return cachedNativeAnnotation = internal.getConstructor("ExternalName");
73 } 78 }
74 79
75 void loadExtraRequiredLibraries(Loader loader) { 80 void loadExtraRequiredLibraries(Loader loader) {
76 for (String uri in new VmTarget(null).extraRequiredLibraries) { 81 kernel.Target target =
82 forDart2js ? new Dart2jsTarget(null) : new VmTarget(null);
83 for (String uri in target.extraRequiredLibraries) {
77 loader.read(Uri.parse(uri)); 84 loader.read(Uri.parse(uri));
78 } 85 }
79 } 86 }
80 87
81 void addSourceInformation( 88 void addSourceInformation(
82 Uri uri, List<int> lineStarts, List<int> sourceCode); 89 Uri uri, List<int> lineStarts, List<int> sourceCode);
83 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698