| Index: pkg/front_end/lib/src/incremental/file_state.dart
|
| diff --git a/pkg/front_end/lib/src/incremental/file_state.dart b/pkg/front_end/lib/src/incremental/file_state.dart
|
| index d060d02e7849f534c2037fcd3378235641b7c662..cb0a0d6d44254af58f384173d25a2bb8dc5431e7 100644
|
| --- a/pkg/front_end/lib/src/incremental/file_state.dart
|
| +++ b/pkg/front_end/lib/src/incremental/file_state.dart
|
| @@ -15,7 +15,7 @@ import 'package:front_end/src/fasta/uri_translator.dart';
|
| import 'package:front_end/src/byte_store/byte_store.dart';
|
| import 'package:front_end/src/incremental/format.dart';
|
| import 'package:front_end/src/incremental/unlinked_unit.dart';
|
| -import 'package:kernel/target/vm.dart';
|
| +import 'package:kernel/target/targets.dart';
|
|
|
| /// This function is called for each newly discovered file, and the returned
|
| /// [Future] is awaited before reading the file content.
|
| @@ -182,7 +182,7 @@ class FileState {
|
| _importedLibraries.add(file);
|
| }
|
| }
|
| - await _addVmTargetImportsForCore();
|
| + await _addTargetExtraRequiredLibraries();
|
| for (var export_ in unlinkedUnit.exports) {
|
| FileState file = await _getFileForRelativeUri(export_.uri);
|
| if (file != null) {
|
| @@ -228,13 +228,14 @@ class FileState {
|
| return uri.toString();
|
| }
|
|
|
| - /// Fasta unconditionally loads all VM libraries. In order to be able to
|
| - /// serve them using the file system view, pretend that all of them were
|
| - /// imported into `dart:core`.
|
| - /// TODO(scheglov) Ask VM people whether all these libraries are required.
|
| - Future<Null> _addVmTargetImportsForCore() async {
|
| + /// Fasta unconditionally loads extra libraries based on the target. In order
|
| + /// to be able to serve them using the file system view, pretend that all of
|
| + /// them were imported into `dart:core`.
|
| + /// TODO(scheglov,sigmund): remove this implicit import, instead make fasta
|
| + /// and IKG aware of extra code that needs to be loaded.
|
| + Future<Null> _addTargetExtraRequiredLibraries() async {
|
| if (uri.toString() != 'dart:core') return;
|
| - for (String uri in new VmTarget(null).extraRequiredLibraries) {
|
| + for (String uri in _fsState.target.extraRequiredLibraries) {
|
| FileState file = await _getFileForRelativeUri(uri);
|
| // TODO(scheglov) add error handling
|
| if (file != null) {
|
| @@ -267,6 +268,7 @@ class FileState {
|
| class FileSystemState {
|
| final ByteStore _byteStore;
|
| final FileSystem fileSystem;
|
| + final Target target;
|
| final UriTranslator uriTranslator;
|
| final List<int> _salt;
|
| final NewFileFn _newFileFn;
|
| @@ -285,8 +287,8 @@ class FileSystemState {
|
| /// We do this when we use SDK outline instead of compiling SDK sources.
|
| final Set<Uri> skipSdkLibraries = new Set<Uri>();
|
|
|
| - FileSystemState(this._byteStore, this.fileSystem, this.uriTranslator,
|
| - this._salt, this._newFileFn);
|
| + FileSystemState(this._byteStore, this.fileSystem, this.target,
|
| + this.uriTranslator, this._salt, this._newFileFn);
|
|
|
| /// Return the [FileSystem] that is backed by this [FileSystemState]. The
|
| /// files in this [FileSystem] always have the same content as the
|
|
|