Version 2.18.0-42.0.dev
Merge commit '618db8a41d68fd37ff5bb228c69486721be3a636' into 'dev'
diff --git a/DEPS b/DEPS
index db75ce7..2e636f4 100644
--- a/DEPS
+++ b/DEPS
@@ -54,7 +54,7 @@
# Checkout Android dependencies only on Mac and Linux.
"download_android_deps":
- "host_os == mac or (host_os == linux and host_cpu == x64)",
+ "(host_os == mac or host_os == linux) and host_cpu == x64",
# Checkout extra javascript engines for testing or benchmarking.
# d8, the V8 shell, is always checked out.
@@ -531,7 +531,7 @@
Var("dart_root") + "/third_party/android_tools/ndk": {
"packages": [
{
- "package": "flutter/android/ndk/${{os}}-amd64",
+ "package": "flutter/android/ndk/${{platform}}",
"version": "version:r21.0.6113669"
}
],
@@ -542,7 +542,7 @@
Var("dart_root") + "/third_party/android_tools/sdk/build-tools": {
"packages": [
{
- "package": "flutter/android/sdk/build-tools/${{os}}-amd64",
+ "package": "flutter/android/sdk/build-tools/${{platform}}",
"version": "version:30.0.1"
}
],
@@ -553,7 +553,7 @@
Var("dart_root") + "/third_party/android_tools/sdk/platform-tools": {
"packages": [
{
- "package": "flutter/android/sdk/platform-tools/${{os}}-amd64",
+ "package": "flutter/android/sdk/platform-tools/${{platform}}",
"version": "version:29.0.2"
}
],
@@ -575,7 +575,7 @@
Var("dart_root") + "/third_party/android_tools/sdk/tools": {
"packages": [
{
- "package": "flutter/android/sdk/tools/${{os}}-amd64",
+ "package": "flutter/android/sdk/tools/${{platform}}",
"version": "version:26.1.1"
}
],
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index f5def03..c61d41a 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -26,9 +26,6 @@
# architecture, which is different than the names GN uses.
if (host_cpu == "x64" || host_cpu == "x86") {
android_host_arch = "x86_64"
- } else if (host_cpu == "arm64") {
- # Run existing Android toolchain via Rosetta.
- android_host_arch = "x86_64"
} else {
assert(false, "Need Android toolchain support for your build CPU arch.")
}
diff --git a/pkg/analysis_server/test/edit/bulk_fixes_test.dart b/pkg/analysis_server/test/edit/bulk_fixes_test.dart
index 721560d..d3c47c2 100644
--- a/pkg/analysis_server/test/edit/bulk_fixes_test.dart
+++ b/pkg/analysis_server/test/edit/bulk_fixes_test.dart
@@ -262,7 +262,6 @@
}
Future<EditBulkFixesResult> _getBulkFixes() async {
- // TODO(scheglov) Remove this, we want to see if lines change.
var request = EditBulkFixesParams([workspaceRoot.path]).toRequest('0');
var response = await handleSuccessfulRequest(request);
return EditBulkFixesResult.fromResponse(response);
diff --git a/pkg/compiler/README.md b/pkg/compiler/README.md
index bf2c604..939a841 100644
--- a/pkg/compiler/README.md
+++ b/pkg/compiler/README.md
@@ -245,9 +245,9 @@
command-line tool to launch dart2js, but also by pub to invoke dart2js as a
library during `pub-build` and `pub-serve`.
-* `lib/compiler.dart`: the compiler API. This API is used by our command-line
- tool to spawn the dart2js compiler. This API (and everything that is
- transitively created from it) has no dependencies on `dart:io` so that the
+* `lib/compiler_api.dart`: the compiler API. This API is used by our
+ command-line tool to spawn the dart2js compiler. This API (and everything that
+ is transitively created from it) has no dependencies on `dart:io` so that the
compiler can be used in contexts where `dart:io` is not available (e.g.
running in a browser worker) or where `dart:io` is not used explicitly (e.g.
running as a pub transformer).
diff --git a/pkg/compiler/lib/compiler.dart b/pkg/compiler/lib/compiler_api.dart
similarity index 100%
rename from pkg/compiler/lib/compiler.dart
rename to pkg/compiler/lib/compiler_api.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 93ca227..e1fc64b 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -12,7 +12,7 @@
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
import 'package:kernel/ast.dart' as ir;
-import '../compiler.dart' as api;
+import '../compiler_api.dart' as api;
import 'common.dart';
import 'common/codegen.dart';
import 'common/elements.dart' show ElementEnvironment;
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 099cf5d..acae13d 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -13,7 +13,7 @@
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
-import '../compiler.dart' as api;
+import '../compiler_api.dart' as api;
import 'commandline_options.dart';
import 'options.dart' show CompilerOptions, FeatureOptions;
import 'source_file_provider.dart';
diff --git a/pkg/compiler/lib/src/deferred_load/deferred_load.dart b/pkg/compiler/lib/src/deferred_load/deferred_load.dart
index ab74ec9..e3201e0 100644
--- a/pkg/compiler/lib/src/deferred_load/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load/deferred_load.dart
@@ -277,7 +277,7 @@
import 'import_set.dart';
import 'output_unit.dart';
-import '../../compiler.dart' show OutputType;
+import '../../compiler_api.dart' as api show OutputType;
import '../common.dart';
import '../common/elements.dart' show KElementEnvironment;
import '../common/metrics.dart'
@@ -471,7 +471,7 @@
}
}
compiler.outputProvider.createOutputSink(
- compiler.options.deferredGraphUri.path, '', OutputType.debug)
+ compiler.options.deferredGraphUri.path, '', api.OutputType.debug)
..add(graph.join('\n'))
..close();
}
diff --git a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
index c889753..98e583a 100644
--- a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
+++ b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
@@ -6,7 +6,7 @@
library dart2js.diagnostic_listener;
-import '../../compiler.dart' as api;
+import '../../compiler_api.dart' as api;
import '../compiler.dart' show Compiler;
import '../elements/entities.dart';
import '../io/source_information.dart';
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 2f6b2bd..3521af7 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -14,7 +14,7 @@
import 'package:dart2js_info/binary_serialization.dart' as dump_info;
import 'package:kernel/ast.dart' as ir;
-import '../compiler.dart';
+import '../compiler_api.dart' as api;
import 'common.dart';
import 'common/elements.dart' show JElementEnvironment;
import 'common/names.dart';
@@ -1222,7 +1222,7 @@
.encode(data));
final name = (compiler.options.outputUri?.pathSegments?.last ?? 'out');
compiler.outputProvider
- .createOutputSink(name, 'info.json', OutputType.dumpInfo)
+ .createOutputSink(name, 'info.json', api.OutputType.dumpInfo)
..add(jsonBuffer.toString())
..close();
compiler.reporter
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
index f922fef..e2d23d2 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -6,7 +6,7 @@
import 'package:kernel/ast.dart' as ir;
-import '../../compiler.dart';
+import '../../compiler_api.dart' as api;
import '../closure.dart';
import '../common.dart';
import '../common/elements.dart';
@@ -89,7 +89,7 @@
final CompilerOptions _options;
final Progress _progress;
final DiagnosticReporter _reporter;
- final CompilerOutput _compilerOutput;
+ final api.CompilerOutput _compilerOutput;
final Set<ConstructorEntity> _generativeConstructorsExposingThis =
Set<ConstructorEntity>();
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
index c8b80af..408c76c 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
@@ -6,7 +6,7 @@
library dart2js.inferrer.type_graph_dump;
-import '../../compiler.dart';
+import '../../compiler_api.dart' as api;
import '../elements/entities.dart';
import '../elements/entity_utils.dart' as utils;
import 'abstract_value_domain.dart';
@@ -33,7 +33,7 @@
class TypeGraphDump {
static const String outputDir = 'typegraph';
- final CompilerOutput compilerOutput;
+ final api.CompilerOutput compilerOutput;
final InferrerEngine inferrer;
final Map<TypeInformation, Set<TypeInformation>> assignmentsBeforeAnalysis =
<TypeInformation, Set<TypeInformation>>{};
@@ -78,11 +78,11 @@
}
// Print every group separately.
for (MemberEntity element in nodes.keys) {
- OutputSink output;
+ api.OutputSink output;
try {
String name = filenameFromElement(element);
output = compilerOutput.createOutputSink(
- '$outputDir/$name', 'dot', OutputType.debug);
+ '$outputDir/$name', 'dot', api.OutputType.debug);
_GraphGenerator visitor = _GraphGenerator(
this, element, output, inferrer.abstractValueDomain.getCompactText);
for (TypeInformation node in nodes[element]) {
@@ -143,7 +143,7 @@
final Map<TypeInformation, int> nodeId = <TypeInformation, int>{};
final String Function(AbstractValue) formatType;
int usedIds = 0;
- final OutputSink output;
+ final api.OutputSink output;
final MemberEntity element;
TypeInformation returnValue;
diff --git a/pkg/compiler/lib/src/io/code_output.dart b/pkg/compiler/lib/src/io/code_output.dart
index b603c00..869cfa7 100644
--- a/pkg/compiler/lib/src/io/code_output.dart
+++ b/pkg/compiler/lib/src/io/code_output.dart
@@ -6,7 +6,7 @@
library dart2js.code_output;
-import '../../compiler.dart' as api show OutputSink;
+import '../../compiler_api.dart' as api show OutputSink;
import 'code_output_listener.dart';
export 'code_output_listener.dart';
import 'source_information.dart';
diff --git a/pkg/compiler/lib/src/io/source_file.dart b/pkg/compiler/lib/src/io/source_file.dart
index 961127c..489f6c6 100644
--- a/pkg/compiler/lib/src/io/source_file.dart
+++ b/pkg/compiler/lib/src/io/source_file.dart
@@ -13,17 +13,17 @@
import 'package:kernel/ast.dart' as kernel show Location, Source;
import 'location_provider.dart' show LocationProvider;
-import '../../compiler.dart' show Input, InputKind;
+import '../../compiler_api.dart' as api show Input, InputKind;
/// Represents a file of source code. The content can be either a [String] or
/// a UTF-8 encoded [List<int>] of bytes.
-abstract class SourceFile<T> implements Input<T>, LocationProvider {
+abstract class SourceFile<T> implements api.Input<T>, LocationProvider {
/// The absolute URI of the source file.
@override
Uri get uri;
@override
- InputKind get inputKind => InputKind.UTF8;
+ api.InputKind get inputKind => api.InputKind.UTF8;
kernel.Source cachedKernelSource;
@@ -294,7 +294,7 @@
}
/// Binary input data.
-class Binary implements Input<List<int>> {
+class Binary implements api.Input<List<int>> {
@override
final Uri uri;
List<int> /*?*/ _data;
@@ -308,7 +308,7 @@
}
@override
- InputKind get inputKind => InputKind.binary;
+ api.InputKind get inputKind => api.InputKind.binary;
@override
void release() {
diff --git a/pkg/compiler/lib/src/io/source_map_builder.dart b/pkg/compiler/lib/src/io/source_map_builder.dart
index f6c3e3a..fd0a930 100644
--- a/pkg/compiler/lib/src/io/source_map_builder.dart
+++ b/pkg/compiler/lib/src/io/source_map_builder.dart
@@ -8,7 +8,8 @@
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
import 'package:kernel/ast.dart' show Location;
-import '../../compiler.dart' show CompilerOutput, OutputSink, OutputType;
+import '../../compiler_api.dart' as api
+ show CompilerOutput, OutputSink, OutputType;
import '../util/util.dart';
import 'location_provider.dart';
import 'code_output.dart' show SourceLocationsProvider, SourceLocations;
@@ -268,7 +269,7 @@
/// [sourceLocationsProvider] for the .js code in [locationProvider]
/// [sourceMapUri] is used to relativizes the URIs of the referenced source
/// files and the target [fileUri]. [name] and [outputProvider] are used to
- /// create the [OutputSink] for the source map text.
+ /// create the [api.OutputSink] for the source map text.
static void outputSourceMap(
SourceLocationsProvider sourceLocationsProvider,
LocationProvider locationProvider,
@@ -277,7 +278,7 @@
String name,
Uri sourceMapUri,
Uri fileUri,
- CompilerOutput compilerOutput) {
+ api.CompilerOutput compilerOutput) {
// Create a source file for the compilation output. This allows using
// [:getLine:] to transform offsets to line numbers in [SourceMapBuilder].
int index = 0;
@@ -302,7 +303,7 @@
extension = 'js.map.${sourceLocations.name}';
}
}
- compilerOutput.createOutputSink(name, extension, OutputType.sourceMap)
+ compilerOutput.createOutputSink(name, extension, api.OutputType.sourceMap)
..add(sourceMap)
..close();
index++;
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
index 7136d66..44f657d 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -6,7 +6,7 @@
library dart2js.js_emitter.startup_emitter;
-import '../../../compiler.dart';
+import '../../../compiler_api.dart' as api;
import '../../common.dart';
import '../../common/codegen.dart';
import '../../constants/values.dart';
@@ -158,7 +158,7 @@
EmitterImpl(
CompilerOptions options,
this._reporter,
- CompilerOutput outputProvider,
+ api.CompilerOutput outputProvider,
DumpInfoTask dumpInfoTask,
Namer namer,
this._closedWorld,
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 7bd5937..242dc31 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -34,7 +34,7 @@
import 'package:js_ast/src/precedence.dart' as js_precedence;
-import '../../../compiler.dart';
+import '../../../compiler_api.dart' as api;
import '../../common.dart';
import '../../common/elements.dart' show CommonElements, JElementEnvironment;
import '../../common/tasks.dart';
@@ -101,7 +101,7 @@
class ModelEmitter {
final CompilerOptions _options;
final DiagnosticReporter _reporter;
- final CompilerOutput _outputProvider;
+ final api.CompilerOutput _outputProvider;
final DumpInfoTask _dumpInfoTask;
final Namer _namer;
final CompilerTask _task;
@@ -424,7 +424,7 @@
}
CodeOutput mainOutput = StreamCodeOutput(
- _outputProvider.createOutputSink('', 'js', OutputType.js),
+ _outputProvider.createOutputSink('', 'js', api.OutputType.js),
codeOutputListeners);
emittedOutputBuffers[fragment.outputUnit] = mainOutput;
@@ -497,7 +497,7 @@
String outputFileName = fragment.outputFileName;
CodeOutput output = StreamCodeOutput(
_outputProvider.createOutputSink(
- outputFileName, deferredExtension, OutputType.jsPart),
+ outputFileName, deferredExtension, api.OutputType.jsPart),
outputListeners);
writeCodeFragments(fragmentCode, fragmentHashes, output);
@@ -604,7 +604,7 @@
"needed for a given deferred library import.";
mapping.addAll(fragmentMerger.computeDeferredMap(finalizedFragmentsToLoad));
_outputProvider.createOutputSink(
- _options.deferredMapUri.path, '', OutputType.deferredMap)
+ _options.deferredMapUri.path, '', api.OutputType.deferredMap)
..add(const JsonEncoder.withIndent(" ").convert(mapping))
..close();
}
diff --git a/pkg/compiler/lib/src/kernel/front_end_adapter.dart b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
index 1243e98..e86e6d3 100644
--- a/pkg/compiler/lib/src/kernel/front_end_adapter.dart
+++ b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
@@ -12,7 +12,7 @@
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
-import '../../compiler.dart' as api;
+import '../../compiler_api.dart' as api;
import '../common.dart';
import '../io/source_file.dart';
diff --git a/pkg/compiler/lib/src/null_compiler_output.dart b/pkg/compiler/lib/src/null_compiler_output.dart
index 0ea46dd..d7a0eb1 100644
--- a/pkg/compiler/lib/src/null_compiler_output.dart
+++ b/pkg/compiler/lib/src/null_compiler_output.dart
@@ -4,29 +4,30 @@
// @dart = 2.10
-/// Null pattern implementation of the [CompilerOutput] interface.
+/// Null pattern implementation of the [api.CompilerOutput] interface.
library compiler.null_api;
-import '../compiler.dart';
+import '../compiler_api.dart' as api;
-/// Null pattern implementation of the [CompilerOutput] interface.
-class NullCompilerOutput implements CompilerOutput {
+/// Null pattern implementation of the [api.CompilerOutput] interface.
+class NullCompilerOutput implements api.CompilerOutput {
const NullCompilerOutput();
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
return NullSink.outputProvider(name, extension, type);
}
@override
- BinaryOutputSink createBinarySink(Uri uri) {
+ api.BinaryOutputSink createBinarySink(Uri uri) {
return NullBinarySink(uri);
}
}
-/// A sink that drains into /dev/null.
-class NullSink implements OutputSink {
+/// A sink that discards the data.
+class NullSink implements api.OutputSink {
final String name;
NullSink(this.name);
@@ -42,12 +43,12 @@
/// Convenience method for getting an [api.CompilerOutputProvider].
static NullSink outputProvider(
- String name, String extension, OutputType type) {
+ String name, String extension, api.OutputType type) {
return NullSink('$name.$extension.$type');
}
}
-class NullBinarySink implements BinaryOutputSink {
+class NullBinarySink implements api.BinaryOutputSink {
final Uri uri;
NullBinarySink(this.uri);
diff --git a/pkg/compiler/lib/src/phase/load_kernel.dart b/pkg/compiler/lib/src/phase/load_kernel.dart
index f654265..803c8f9 100644
--- a/pkg/compiler/lib/src/phase/load_kernel.dart
+++ b/pkg/compiler/lib/src/phase/load_kernel.dart
@@ -14,7 +14,7 @@
import 'package:kernel/kernel.dart' hide LibraryDependency, Combinator;
import 'package:kernel/target/targets.dart' hide DiagnosticReporter;
-import '../../compiler.dart' as api;
+import '../../compiler_api.dart' as api;
import '../commandline_options.dart';
import '../common.dart';
import '../kernel/front_end_adapter.dart';
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index 6e5f7df..a534865 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -9,7 +9,7 @@
import 'package:kernel/binary/ast_from_binary.dart' as ir;
import 'package:kernel/binary/ast_to_binary.dart' as ir;
import 'package:front_end/src/fasta/util/bytes_sink.dart';
-import '../../compiler.dart' as api;
+import '../../compiler_api.dart' as api;
import '../commandline_options.dart' show Flags;
import '../common/codegen.dart';
import '../common/tasks.dart';
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index 4099ddc..b28f72a 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -13,13 +13,12 @@
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
-import '../compiler.dart' as api;
-import '../compiler.dart';
+import '../compiler_api.dart' as api;
import 'colors.dart' as colors;
import 'dart2js.dart' show AbortLeg;
import 'io/source_file.dart';
-abstract class SourceFileProvider implements CompilerInput {
+abstract class SourceFileProvider implements api.CompilerInput {
bool isWindows = (Platform.operatingSystem == 'windows');
Uri cwd = Uri.base;
Map<Uri, api.Input> utf8SourceFiles = <Uri, api.Input>{};
@@ -80,7 +79,7 @@
/// returned.
api.Input autoReadFromFile(Uri resourceUri) {
try {
- return _readFromFileSync(resourceUri, InputKind.UTF8);
+ return _readFromFileSync(resourceUri, api.InputKind.UTF8);
} catch (e) {
// Silence the error. The [resourceUri] was not requested by the user and
// was only needed to give better error messages.
@@ -169,11 +168,11 @@
class CompilerSourceFileProvider extends SourceFileProvider {
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind = InputKind.UTF8}) =>
+ {api.InputKind inputKind = api.InputKind.UTF8}) =>
readBytesFromUri(uri, inputKind);
}
-class FormattingDiagnosticHandler implements CompilerDiagnostics {
+class FormattingDiagnosticHandler implements api.CompilerDiagnostics {
final SourceFileProvider provider;
bool showWarnings = true;
bool showHints = true;
@@ -296,7 +295,7 @@
typedef MessageCallback = void Function(String message);
-class RandomAccessFileOutputProvider implements CompilerOutput {
+class RandomAccessFileOutputProvider implements api.CompilerOutput {
final Uri out;
final Uri sourceMapOut;
final MessageCallback onInfo;
@@ -312,31 +311,31 @@
RandomAccessFileOutputProvider(this.out, this.sourceMapOut,
{this.onInfo, this.onFailure});
- Uri createUri(String name, String extension, OutputType type) {
+ Uri createUri(String name, String extension, api.OutputType type) {
Uri uri;
// TODO(johnniwinther): Unify handle of [name] and [extension] to prepare
// for using a single, possibly relative, [uri] as input.
switch (type) {
- case OutputType.js:
+ case api.OutputType.js:
if (name == '') {
uri = out;
} else {
uri = out.resolve('$name.$extension');
}
break;
- case OutputType.sourceMap:
+ case api.OutputType.sourceMap:
if (name == '') {
uri = sourceMapOut;
} else {
uri = out.resolve('$name.$extension');
}
break;
- case OutputType.jsPart:
+ case api.OutputType.jsPart:
uri = out.resolve('$name.$extension');
break;
- case OutputType.dumpInfo:
- case OutputType.dumpUnusedLibraries:
- case OutputType.deferredMap:
+ case api.OutputType.dumpInfo:
+ case api.OutputType.dumpUnusedLibraries:
+ case api.OutputType.deferredMap:
if (name == '') {
name = out.pathSegments.last;
}
@@ -346,7 +345,7 @@
uri = out.resolve('$name.$extension');
}
break;
- case OutputType.debug:
+ case api.OutputType.debug:
if (name == '') {
name = out.pathSegments.last;
}
@@ -359,7 +358,8 @@
}
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
Uri uri = createUri(name, extension, type);
bool isPrimaryOutput = uri == out;
@@ -398,7 +398,7 @@
if (isPrimaryOutput) {
totalCharactersWrittenPrimary += charactersWritten;
}
- if (type == OutputType.js || type == OutputType.jsPart) {
+ if (type == api.OutputType.js || type == api.OutputType.jsPart) {
totalCharactersWrittenJavaScript += charactersWritten;
}
}
@@ -407,7 +407,7 @@
}
@override
- BinaryOutputSink createBinarySink(Uri uri) {
+ api.BinaryOutputSink createBinarySink(Uri uri) {
uri = Uri.base.resolveUri(uri);
allOutputFiles.add(fe.relativizeUri(Uri.base, uri, Platform.isWindows));
@@ -457,7 +457,7 @@
}
}
-class _OutputSinkWrapper extends OutputSink {
+class _OutputSinkWrapper extends api.OutputSink {
void Function(String) onAdd;
void Function() onClose;
@@ -470,7 +470,7 @@
void close() => onClose();
}
-class _BinaryOutputSinkWrapper extends BinaryOutputSink {
+class _BinaryOutputSinkWrapper extends api.BinaryOutputSink {
void Function(List<int>, [int, int]) onWrite;
void Function() onClose;
@@ -529,7 +529,7 @@
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind = InputKind.UTF8}) async {
+ {api.InputKind inputKind = api.InputKind.UTF8}) async {
var resolvedUri = uri;
var path = uri.path;
if (path.startsWith('/bazel-root')) {
@@ -545,10 +545,10 @@
api.Input<List<int>> result =
await readBytesFromUri(resolvedUri, inputKind);
switch (inputKind) {
- case InputKind.UTF8:
+ case api.InputKind.UTF8:
utf8SourceFiles[uri] = utf8SourceFiles[resolvedUri];
break;
- case InputKind.binary:
+ case api.InputKind.binary:
binarySourceFiles[uri] = binarySourceFiles[resolvedUri];
break;
}
@@ -590,7 +590,7 @@
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind = InputKind.UTF8}) async {
+ {api.InputKind inputKind = api.InputKind.UTF8}) async {
var resolvedUri = uri;
if (resolvedUri.isScheme(markerScheme)) {
var path = resolvedUri.path;
@@ -606,10 +606,10 @@
api.Input<List<int>> result =
await readBytesFromUri(resolvedUri, inputKind);
switch (inputKind) {
- case InputKind.UTF8:
+ case api.InputKind.UTF8:
utf8SourceFiles[uri] = utf8SourceFiles[resolvedUri];
break;
- case InputKind.binary:
+ case api.InputKind.binary:
binarySourceFiles[uri] = binarySourceFiles[resolvedUri];
break;
}
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index a47bd34..0db158a 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -6,7 +6,7 @@
library ssa.tracer;
-import '../../compiler.dart' show OutputSink;
+import '../../compiler_api.dart' as api show OutputSink;
import '../diagnostics/invariant.dart' show DEBUG_MODE;
import '../inferrer/abstract_value_domain.dart';
import '../js_backend/namer.dart' show suffixForGetInterceptor;
@@ -20,7 +20,7 @@
class HTracer extends HGraphVisitor with TracerUtil {
final JClosedWorld closedWorld;
@override
- final OutputSink output;
+ final api.OutputSink output;
HTracer(this.output, this.closedWorld);
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index 9ecb938..217adb5 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -8,7 +8,7 @@
import 'package:kernel/text/indentation.dart' show Indentation;
-import '../compiler.dart' as api;
+import '../compiler_api.dart' as api;
import 'options.dart' show CompilerOptions;
import 'ssa/nodes.dart' as ssa show HGraph;
import 'ssa/ssa_tracer.dart' show HTracer;
diff --git a/pkg/compiler/lib/src/util/sink_adapter.dart b/pkg/compiler/lib/src/util/sink_adapter.dart
index da29d86..7e249ebd 100644
--- a/pkg/compiler/lib/src/util/sink_adapter.dart
+++ b/pkg/compiler/lib/src/util/sink_adapter.dart
@@ -4,7 +4,7 @@
// @dart = 2.10
-import '../../compiler.dart' as api;
+import '../../compiler_api.dart' as api;
class BinaryOutputSinkAdapter implements Sink<List<int>> {
api.BinaryOutputSink output;
diff --git a/pkg/compiler/test/codegen/expect_annotations2_test.dart b/pkg/compiler/test/codegen/expect_annotations2_test.dart
index 6c2cb0f..b970220 100644
--- a/pkg/compiler/test/codegen/expect_annotations2_test.dart
+++ b/pkg/compiler/test/codegen/expect_annotations2_test.dart
@@ -6,7 +6,7 @@
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import '../helpers/memory_compiler.dart';
@@ -48,7 +48,7 @@
options: [Flags.testMode]);
// Simply check that the constants of the small functions are still in the
// output, and that we don't see the result of constant folding.
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
Expect.isTrue(jsOutput.contains('49912344'));
Expect.isTrue(jsOutput.contains('123455'));
diff --git a/pkg/compiler/test/codegen/number_output_test.dart b/pkg/compiler/test/codegen/number_output_test.dart
index 8ddf7f1..9af99c3 100644
--- a/pkg/compiler/test/codegen/number_output_test.dart
+++ b/pkg/compiler/test/codegen/number_output_test.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'package:expect/expect.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/memory_compiler.dart';
@@ -34,7 +34,7 @@
options: options);
// Check that we use the shorter exponential representations.
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
print(jsOutput);
if (minify) {
diff --git a/pkg/compiler/test/codegen/unused_empty_map_test.dart b/pkg/compiler/test/codegen/unused_empty_map_test.dart
index c38440f..1cd3b7b 100644
--- a/pkg/compiler/test/codegen/unused_empty_map_test.dart
+++ b/pkg/compiler/test/codegen/unused_empty_map_test.dart
@@ -7,7 +7,7 @@
// Ensure that unused empty HashMap nodes are dropped from the output.
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
@@ -27,7 +27,7 @@
var collector = new OutputCollector();
await runCompiler(
memorySourceFiles: TEST_SOURCE, outputProvider: collector);
- String generated = collector.getOutput('', OutputType.js);
+ String generated = collector.getOutput('', api.OutputType.js);
Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR));
}
diff --git a/pkg/compiler/test/codegen/use_strict_test.dart b/pkg/compiler/test/codegen/use_strict_test.dart
index 520d986..a9e780d 100644
--- a/pkg/compiler/test/codegen/use_strict_test.dart
+++ b/pkg/compiler/test/codegen/use_strict_test.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
@@ -53,7 +53,7 @@
OutputCollector collector = new OutputCollector();
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
// Skip comments.
List<String> lines = jsOutput.split("\n");
diff --git a/pkg/compiler/test/deferred/closures_test.dart b/pkg/compiler/test/deferred/closures_test.dart
index 1f60716..e498107 100644
--- a/pkg/compiler/test/deferred/closures_test.dart
+++ b/pkg/compiler/test/deferred/closures_test.dart
@@ -7,7 +7,7 @@
// Ensures that closures are in the output unit of their enclosing element.
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
@@ -22,8 +22,8 @@
runTest() async {
OutputCollector collector = new OutputCollector();
await runCompiler(memorySourceFiles: sources, outputProvider: collector);
- String mainOutput = collector.getOutput("", OutputType.js);
- String deferredOutput = collector.getOutput("out_1", OutputType.jsPart);
+ String mainOutput = collector.getOutput("", api.OutputType.js);
+ String deferredOutput = collector.getOutput("out_1", api.OutputType.jsPart);
Expect.isTrue(mainOutput.contains("other_method_name() {"));
Expect.isFalse(mainOutput.contains("unique_method_name() {"));
diff --git a/pkg/compiler/test/deferred/emit_type_checks_test.dart b/pkg/compiler/test/deferred/emit_type_checks_test.dart
index 6e0ba61..ef7d732 100644
--- a/pkg/compiler/test/deferred/emit_type_checks_test.dart
+++ b/pkg/compiler/test/deferred/emit_type_checks_test.dart
@@ -8,7 +8,7 @@
// Files when using deferred loading.
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
import 'package:expect/expect.dart';
@@ -20,8 +20,8 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
Compiler compiler = result.compiler;
- String mainOutput = collector.getOutput('', OutputType.js);
- String deferredOutput = collector.getOutput('out_1', OutputType.jsPart);
+ String mainOutput = collector.getOutput('', api.OutputType.js);
+ String deferredOutput = collector.getOutput('out_1', api.OutputType.jsPart);
JsBackendStrategy backendStrategy = compiler.backendStrategy;
String isPrefix =
backendStrategy.namerForTesting.fixedNames.operatorIsPrefix;
diff --git a/pkg/compiler/test/deferred/inline_restrictions_test.dart b/pkg/compiler/test/deferred/inline_restrictions_test.dart
index 7a47744..9d49871 100644
--- a/pkg/compiler/test/deferred/inline_restrictions_test.dart
+++ b/pkg/compiler/test/deferred/inline_restrictions_test.dart
@@ -8,7 +8,7 @@
// allow inlining of empty functions and from main.
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/compiler.dart';
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
@@ -34,11 +34,11 @@
// Test that we actually got different output units.
Expect.notEquals(ou_lib1.name, ou_lib3.name);
- String mainOutput = collector.getOutput("", OutputType.js);
+ String mainOutput = collector.getOutput("", api.OutputType.js);
String lib1Output =
- collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart);
+ collector.getOutput("out_${ou_lib1.name}", api.OutputType.jsPart);
String lib3Output =
- collector.getOutput("out_${ou_lib3.name}", OutputType.jsPart);
+ collector.getOutput("out_${ou_lib3.name}", api.OutputType.jsPart);
// Test that inlineMeAway was inlined and its argument thus dropped.
//
diff --git a/pkg/compiler/test/deferred/load_mapping_test.dart b/pkg/compiler/test/deferred/load_mapping_test.dart
index dd18b21..0cfe371 100644
--- a/pkg/compiler/test/deferred/load_mapping_test.dart
+++ b/pkg/compiler/test/deferred/load_mapping_test.dart
@@ -7,7 +7,7 @@
import 'dart:convert';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import '../helpers/memory_compiler.dart';
void testLoadMap() async {
@@ -18,7 +18,7 @@
outputProvider: collector);
// Ensure a mapping file is output.
var deferredMap =
- collector.getOutput("deferred_map.json", OutputType.deferredMap);
+ collector.getOutput("deferred_map.json", api.OutputType.deferredMap);
Expect.isNotNull(deferredMap);
var mapping = jsonDecode(deferredMap);
@@ -38,8 +38,9 @@
memorySourceFiles: MEMORY_SOURCE_FILES,
options: ['--dump-deferred-graph=deferred_graph.txt'],
outputProvider: collector);
- var actual =
- collector.getOutput("deferred_graph.txt", OutputType.debug).split('\n');
+ var actual = collector
+ .getOutput("deferred_graph.txt", api.OutputType.debug)
+ .split('\n');
// This program has 5 deferred imports `convert`, `lib1`, `lib2`, `lib4_1`,
// and `lib4_2`. Most are independent of one another, except for `lib1`
diff --git a/pkg/compiler/test/end_to_end/command_line_test.dart b/pkg/compiler/test/end_to_end/command_line_test.dart
index 2d8b6f8..112f925 100644
--- a/pkg/compiler/test/end_to_end/command_line_test.dart
+++ b/pkg/compiler/test/end_to_end/command_line_test.dart
@@ -11,7 +11,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
-import 'package:compiler/compiler.dart' as api;
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/dart2js.dart' as entry;
import 'package:compiler/src/options.dart' show CompilerOptions;
diff --git a/pkg/compiler/test/end_to_end/dump_info2_test.dart b/pkg/compiler/test/end_to_end/dump_info2_test.dart
index dc28204..96c199e 100644
--- a/pkg/compiler/test/end_to_end/dump_info2_test.dart
+++ b/pkg/compiler/test/end_to_end/dump_info2_test.dart
@@ -6,7 +6,7 @@
import 'dart:convert';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:dart2js_info/info.dart';
import 'package:dart2js_info/json_info_codec.dart';
import 'package:dart2js_info/binary_serialization.dart' as binary;
@@ -122,7 +122,7 @@
info = binary.decode(sink.list);
} else {
info = new AllInfoJsonCodec().decode(
- json.decode(collector.getOutput("out.js", OutputType.dumpInfo)));
+ json.decode(collector.getOutput("out.js", api.OutputType.dumpInfo)));
}
check(info);
}
diff --git a/pkg/compiler/test/end_to_end/exit_code_test.dart b/pkg/compiler/test/end_to_end/exit_code_test.dart
index b42b5fd..537afb3 100644
--- a/pkg/compiler/test/end_to_end/exit_code_test.dart
+++ b/pkg/compiler/test/end_to_end/exit_code_test.dart
@@ -11,7 +11,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
-import 'package:compiler/compiler.dart' as api;
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/codegen.dart';
import 'package:compiler/src/common/work.dart';
diff --git a/pkg/compiler/test/end_to_end/output_type_test.dart b/pkg/compiler/test/end_to_end/output_type_test.dart
index a1bc868..3f64614 100644
--- a/pkg/compiler/test/end_to_end/output_type_test.dart
+++ b/pkg/compiler/test/end_to_end/output_type_test.dart
@@ -11,7 +11,7 @@
import 'dart:io';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/dart2js.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/null_compiler_output.dart';
@@ -24,21 +24,22 @@
import '../helpers/memory_compiler.dart';
-class TestRandomAccessFileOutputProvider implements CompilerOutput {
+class TestRandomAccessFileOutputProvider implements api.CompilerOutput {
final RandomAccessFileOutputProvider provider;
List<String> outputs = <String>[];
TestRandomAccessFileOutputProvider(this.provider);
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
outputs.add(fe.relativizeUri(provider.out,
provider.createUri(name, extension, type), Platform.isWindows));
return NullSink.outputProvider(name, extension, type);
}
@override
- BinaryOutputSink createBinarySink(Uri uri) => new NullBinarySink(uri);
+ api.BinaryOutputSink createBinarySink(Uri uri) => new NullBinarySink(uri);
}
CompileFunc oldCompileFunc;
@@ -52,9 +53,9 @@
print('dart2js ${options.join(' ')}');
TestRandomAccessFileOutputProvider outputProvider;
compileFunc = (CompilerOptions compilerOptions,
- CompilerInput compilerInput,
- CompilerDiagnostics compilerDiagnostics,
- CompilerOutput compilerOutput) async {
+ api.CompilerInput compilerInput,
+ api.CompilerDiagnostics compilerDiagnostics,
+ api.CompilerOutput compilerOutput) async {
return oldCompileFunc(
compilerOptions,
compilerInput,
diff --git a/pkg/compiler/test/end_to_end/user_crash_test.dart b/pkg/compiler/test/end_to_end/user_crash_test.dart
index 1aeaba9..b44eb66 100644
--- a/pkg/compiler/test/end_to_end/user_crash_test.dart
+++ b/pkg/compiler/test/end_to_end/user_crash_test.dart
@@ -9,7 +9,7 @@
import 'package:expect/expect.dart';
import 'package:front_end/src/fasta/messages.dart'
show templateCantReadFile, messageMissingMain;
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import '../helpers/memory_compiler.dart';
final EXCEPTION = 'Crash-marker';
@@ -67,7 +67,7 @@
Future<RunResult> run(
{Map<String, String> memorySourceFiles: const {'main.dart': 'main() {}'},
- CompilerDiagnostics diagnostics}) async {
+ api.CompilerDiagnostics diagnostics}) async {
RunResult result = new RunResult();
await runZoned(() async {
try {
@@ -93,7 +93,8 @@
class CrashingDiagnostics extends DiagnosticCollector {
@override
- void report(code, Uri uri, int begin, int end, String text, Diagnostic kind) {
+ void report(
+ code, Uri uri, int begin, int end, String text, api.Diagnostic kind) {
throw EXCEPTION;
}
}
diff --git a/pkg/compiler/test/equivalence/id_equivalence_helper.dart b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
index d93441e..f0e6458 100644
--- a/pkg/compiler/test/equivalence/id_equivalence_helper.dart
+++ b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
@@ -9,7 +9,7 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
import 'package:compiler/src/common.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/common/elements.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
@@ -163,7 +163,7 @@
}
if (printCode) {
print('--code------------------------------------------------------------');
- print(outputCollector.getOutput('', OutputType.js));
+ print(outputCollector.getOutput('', api.OutputType.js));
print('------------------------------------------------------------------');
}
Compiler compiler = result.compiler;
diff --git a/pkg/compiler/test/helpers/compiler_helper.dart b/pkg/compiler/test/helpers/compiler_helper.dart
index 12abc75..a218fd7 100644
--- a/pkg/compiler/test/helpers/compiler_helper.dart
+++ b/pkg/compiler/test/helpers/compiler_helper.dart
@@ -7,7 +7,7 @@
library compiler_helper;
import 'dart:async';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/elements.dart';
import 'package:compiler/src/compiler.dart' show Compiler;
@@ -103,7 +103,9 @@
if (check != null) {
check(generated);
}
- return returnAll ? outputCollector.getOutput('', OutputType.js) : generated;
+ return returnAll
+ ? outputCollector.getOutput('', api.OutputType.js)
+ : generated;
}
Future<String> compileAll(String code,
@@ -140,7 +142,7 @@
result.isSuccess,
'Unexpected compilation error(s): '
'${diagnosticCollector.errors}');
- return outputCollector.getOutput('', OutputType.js);
+ return outputCollector.getOutput('', api.OutputType.js);
}
String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
diff --git a/pkg/compiler/test/helpers/diagnostic_helper.dart b/pkg/compiler/test/helpers/diagnostic_helper.dart
index 9e91050..daca5c1 100644
--- a/pkg/compiler/test/helpers/diagnostic_helper.dart
+++ b/pkg/compiler/test/helpers/diagnostic_helper.dart
@@ -8,7 +8,8 @@
import 'dart:collection';
-import 'package:compiler/compiler.dart' show CompilerDiagnostics, Diagnostic;
+import 'package:compiler/compiler_api.dart' as api
+ show CompilerDiagnostics, Diagnostic;
import 'package:compiler/src/diagnostics/messages.dart'
show Message, MessageKind;
import 'package:expect/expect.dart';
@@ -19,7 +20,7 @@
final int begin;
final int end;
final String text;
- final Diagnostic kind;
+ final api.Diagnostic kind;
CollectedMessage(
this.message, this.uri, this.begin, this.end, this.text, this.kind);
@@ -33,47 +34,47 @@
}
}
-class DiagnosticCollector implements CompilerDiagnostics {
+class DiagnosticCollector implements api.CompilerDiagnostics {
List<CollectedMessage> messages = <CollectedMessage>[];
@override
void report(covariant Message message, Uri uri, int begin, int end,
- String text, Diagnostic kind) {
+ String text, api.Diagnostic kind) {
messages.add(new CollectedMessage(message, uri, begin, end, text, kind));
}
- Iterable<CollectedMessage> filterMessagesByKinds(List<Diagnostic> kinds) {
+ Iterable<CollectedMessage> filterMessagesByKinds(List<api.Diagnostic> kinds) {
return messages
.where((CollectedMessage message) => kinds.contains(message.kind));
}
Iterable<CollectedMessage> get errors {
- return filterMessagesByKinds([Diagnostic.ERROR]);
+ return filterMessagesByKinds([api.Diagnostic.ERROR]);
}
Iterable<CollectedMessage> get warnings {
- return filterMessagesByKinds([Diagnostic.WARNING]);
+ return filterMessagesByKinds([api.Diagnostic.WARNING]);
}
Iterable<CollectedMessage> get hints {
- return filterMessagesByKinds([Diagnostic.HINT]);
+ return filterMessagesByKinds([api.Diagnostic.HINT]);
}
Iterable<CollectedMessage> get infos {
- return filterMessagesByKinds([Diagnostic.INFO]);
+ return filterMessagesByKinds([api.Diagnostic.INFO]);
}
Iterable<CollectedMessage> get crashes {
- return filterMessagesByKinds([Diagnostic.CRASH]);
+ return filterMessagesByKinds([api.Diagnostic.CRASH]);
}
Iterable<CollectedMessage> get verboseInfos {
- return filterMessagesByKinds([Diagnostic.VERBOSE_INFO]);
+ return filterMessagesByKinds([api.Diagnostic.VERBOSE_INFO]);
}
/// `true` if non-verbose messages has been collected.
bool get hasRegularMessages {
- return messages.any((m) => m.kind != Diagnostic.VERBOSE_INFO);
+ return messages.any((m) => m.kind != api.Diagnostic.VERBOSE_INFO);
}
void clear() {
@@ -83,10 +84,10 @@
void checkMessages(List<Expected> expectedMessages) {
int index = 0;
Iterable<CollectedMessage> messages = filterMessagesByKinds([
- Diagnostic.ERROR,
- Diagnostic.WARNING,
- Diagnostic.HINT,
- Diagnostic.INFO
+ api.Diagnostic.ERROR,
+ api.Diagnostic.WARNING,
+ api.Diagnostic.HINT,
+ api.Diagnostic.INFO
]);
for (CollectedMessage message in messages) {
if (index >= expectedMessages.length) {
@@ -106,21 +107,21 @@
class Expected {
final MessageKind messageKind;
- final Diagnostic diagnosticKind;
+ final api.Diagnostic diagnosticKind;
const Expected(this.messageKind, this.diagnosticKind);
const Expected.error(MessageKind messageKind)
- : this(messageKind, Diagnostic.ERROR);
+ : this(messageKind, api.Diagnostic.ERROR);
const Expected.warning(MessageKind messageKind)
- : this(messageKind, Diagnostic.WARNING);
+ : this(messageKind, api.Diagnostic.WARNING);
const Expected.hint(MessageKind messageKind)
- : this(messageKind, Diagnostic.HINT);
+ : this(messageKind, api.Diagnostic.HINT);
const Expected.info(MessageKind messageKind)
- : this(messageKind, Diagnostic.INFO);
+ : this(messageKind, api.Diagnostic.INFO);
}
void compareWarningKinds(String text, List expectedWarnings,
diff --git a/pkg/compiler/test/helpers/memory_compiler.dart b/pkg/compiler/test/helpers/memory_compiler.dart
index 31866ca..04ec18c 100644
--- a/pkg/compiler/test/helpers/memory_compiler.dart
+++ b/pkg/compiler/test/helpers/memory_compiler.dart
@@ -8,7 +8,7 @@
import 'dart:async';
-import 'package:compiler/compiler.dart'
+import 'package:compiler/compiler_api.dart' as api
show CompilationResult, CompilerDiagnostics, CompilerOutput, Diagnostic;
import 'package:compiler/src/compiler.dart' show Compiler;
import 'package:compiler/src/common.dart';
@@ -24,7 +24,7 @@
import 'memory_source_file_helper.dart';
export 'output_collector.dart';
-export 'package:compiler/compiler.dart' show CompilationResult;
+export 'package:compiler/compiler_api.dart' show CompilationResult;
export 'diagnostic_helper.dart';
String sdkPath = 'sdk/lib';
@@ -40,24 +40,24 @@
String sdkPlatformBinariesPath = sdkPlatformBinariesUri.toString();
-class MultiDiagnostics implements CompilerDiagnostics {
- final List<CompilerDiagnostics> diagnosticsList;
+class MultiDiagnostics implements api.CompilerDiagnostics {
+ final List<api.CompilerDiagnostics> diagnosticsList;
const MultiDiagnostics([this.diagnosticsList = const []]);
@override
void report(covariant Message message, Uri uri, int begin, int end,
- String text, Diagnostic kind) {
- for (CompilerDiagnostics diagnostics in diagnosticsList) {
+ String text, api.Diagnostic kind) {
+ for (api.CompilerDiagnostics diagnostics in diagnosticsList) {
diagnostics.report(message, uri, begin, end, text, kind);
}
}
}
-CompilerDiagnostics createCompilerDiagnostics(
- CompilerDiagnostics diagnostics, SourceFileProvider provider,
+api.CompilerDiagnostics createCompilerDiagnostics(
+ api.CompilerDiagnostics diagnostics, SourceFileProvider provider,
{bool showDiagnostics: true, bool verbose: false}) {
- CompilerDiagnostics handler = diagnostics;
+ api.CompilerDiagnostics handler = diagnostics;
if (showDiagnostics) {
if (diagnostics == null) {
handler = new FormattingDiagnosticHandler(provider)
@@ -81,11 +81,11 @@
/// memorySourceFiles can contain a map of string filename to string file
/// contents or string file name to binary file contents (hence the `dynamic`
/// type for the second parameter).
-Future<CompilationResult> runCompiler(
+Future<api.CompilationResult> runCompiler(
{Map<String, dynamic> memorySourceFiles: const <String, dynamic>{},
Uri entryPoint,
- CompilerDiagnostics diagnosticHandler,
- CompilerOutput outputProvider,
+ api.CompilerDiagnostics diagnosticHandler,
+ api.CompilerOutput outputProvider,
List<String> options: const <String>[],
bool showDiagnostics: true,
Uri librariesSpecificationUri,
@@ -111,15 +111,15 @@
bool isSuccess = await compiler.run();
fe.InitializedCompilerState compilerState =
kernelInitializedCompilerState = compiler.initializedCompilerState;
- return new CompilationResult(compiler,
+ return api.CompilationResult(compiler,
isSuccess: isSuccess, kernelInitializedCompilerState: compilerState);
}
Compiler compilerFor(
{Uri entryPoint,
Map<String, dynamic> memorySourceFiles: const <String, dynamic>{},
- CompilerDiagnostics diagnosticHandler,
- CompilerOutput outputProvider,
+ api.CompilerDiagnostics diagnosticHandler,
+ api.CompilerOutput outputProvider,
List<String> options: const <String>[],
bool showDiagnostics: true,
Uri librariesSpecificationUri,
diff --git a/pkg/compiler/test/helpers/memory_source_file_helper.dart b/pkg/compiler/test/helpers/memory_source_file_helper.dart
index db35ef1..0ab605c 100644
--- a/pkg/compiler/test/helpers/memory_source_file_helper.dart
+++ b/pkg/compiler/test/helpers/memory_source_file_helper.dart
@@ -9,7 +9,7 @@
import 'dart:async' show Future;
export 'dart:io' show Platform;
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/io/source_file.dart'
show Binary, StringSourceFile, Utf8BytesSourceFile;
@@ -27,8 +27,8 @@
MemorySourceFileProvider(Map<String, dynamic> this.memorySourceFiles);
@override
- Future<Input<List<int>>> readBytesFromUri(
- Uri resourceUri, InputKind inputKind) {
+ Future<api.Input<List<int>>> readBytesFromUri(
+ Uri resourceUri, api.InputKind inputKind) {
if (!resourceUri.isScheme('memory')) {
return super.readBytesFromUri(resourceUri, inputKind);
}
@@ -37,20 +37,20 @@
var source = memorySourceFiles[resourceUri.path];
if (source == null) {
- return new Future.error(new Exception(
+ return Future.error(new Exception(
'No such memory file $resourceUri in ${memorySourceFiles.keys}'));
}
- Input<List<int>> input;
+ api.Input<List<int>> input;
StringSourceFile stringFile;
if (source is String) {
stringFile = new StringSourceFile.fromUri(resourceUri, source);
}
switch (inputKind) {
- case InputKind.UTF8:
+ case api.InputKind.UTF8:
input = stringFile ?? new Utf8BytesSourceFile(resourceUri, source);
utf8SourceFiles[resourceUri] = input;
break;
- case InputKind.binary:
+ case api.InputKind.binary:
if (stringFile != null) {
utf8SourceFiles[resourceUri] = stringFile;
source = stringFile.data;
@@ -63,7 +63,7 @@
}
@override
- Future<Input> readFromUri(Uri resourceUri,
- {InputKind inputKind: InputKind.UTF8}) =>
+ Future<api.Input> readFromUri(Uri resourceUri,
+ {api.InputKind inputKind: api.InputKind.UTF8}) =>
readBytesFromUri(resourceUri, inputKind);
}
diff --git a/pkg/compiler/test/helpers/output_collector.dart b/pkg/compiler/test/helpers/output_collector.dart
index 541a2fa..c9c15b9 100644
--- a/pkg/compiler/test/helpers/output_collector.dart
+++ b/pkg/compiler/test/helpers/output_collector.dart
@@ -8,9 +8,9 @@
library output_collector;
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
-class BufferedOutputSink implements OutputSink {
+class BufferedOutputSink implements api.OutputSink {
StringBuffer sb = new StringBuffer();
String text;
@@ -31,7 +31,7 @@
}
}
-class BufferedBinaryOutputSink implements BinaryOutputSink {
+class BufferedBinaryOutputSink implements api.BinaryOutputSink {
final Uri uri;
List<int> list = <int>[];
@@ -52,27 +52,27 @@
}
}
-class CloningOutputSink implements OutputSink {
- final List<OutputSink> sinks;
+class CloningOutputSink implements api.OutputSink {
+ final List<api.OutputSink> sinks;
CloningOutputSink(this.sinks);
@override
void add(String event) {
- sinks.forEach((OutputSink sink) => sink.add(event));
+ sinks.forEach((api.OutputSink sink) => sink.add(event));
}
@override
void close() {
- sinks.forEach((OutputSink sink) => sink.close());
+ sinks.forEach((api.OutputSink sink) => sink.close());
}
}
-class OutputCollector implements CompilerOutput {
- Map<OutputType, Map<String, BufferedOutputSink>> outputMap = {};
+class OutputCollector implements api.CompilerOutput {
+ Map<api.OutputType, Map<String, BufferedOutputSink>> outputMap = {};
Map<Uri, BufferedBinaryOutputSink> binaryOutputMap = {};
- String getOutput(String name, OutputType type) {
+ String getOutput(String name, api.OutputType type) {
Map<String, BufferedOutputSink> sinkMap = outputMap[type];
if (sinkMap == null) {
print("No output available for $type.");
@@ -88,7 +88,7 @@
}
@override
- BinaryOutputSink createBinarySink(Uri uri) {
+ api.BinaryOutputSink createBinarySink(Uri uri) {
return binaryOutputMap.putIfAbsent(
uri, () => new BufferedBinaryOutputSink(uri));
}
@@ -98,7 +98,7 @@
/// `true` if any output other than main output has been collected.
bool get hasExtraOutput {
- for (OutputType type in outputMap.keys) {
+ for (api.OutputType type in outputMap.keys) {
for (String name in outputMap[type].keys) {
if (name != '') return true;
}
@@ -107,16 +107,17 @@
}
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
Map<String, BufferedOutputSink> sinkMap =
outputMap.putIfAbsent(type, () => {});
return sinkMap.putIfAbsent(name, () => new BufferedOutputSink());
}
- Map<OutputType, Map<String, String>> clear() {
- Map<OutputType, Map<String, String>> outputMapResult = {};
+ Map<api.OutputType, Map<String, String>> clear() {
+ Map<api.OutputType, Map<String, String>> outputMapResult = {};
outputMap.forEach(
- (OutputType outputType, Map<String, BufferedOutputSink> sinkMap) {
+ (api.OutputType outputType, Map<String, BufferedOutputSink> sinkMap) {
Map<String, String> sinkMapResult = outputMapResult[outputType] = {};
sinkMap.forEach((String name, BufferedOutputSink sink) {
sinkMapResult[name] = sink.toString();
diff --git a/pkg/compiler/test/inlining/meta_annotations2_test.dart b/pkg/compiler/test/inlining/meta_annotations2_test.dart
index 2c719cc..8866855 100644
--- a/pkg/compiler/test/inlining/meta_annotations2_test.dart
+++ b/pkg/compiler/test/inlining/meta_annotations2_test.dart
@@ -8,7 +8,7 @@
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import '../helpers/memory_compiler.dart';
@@ -50,7 +50,7 @@
options: [Flags.testMode]);
// Simply check that the constants of the small functions are still in the
// output, and that we don't see the result of constant folding.
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
void has(String text) {
Expect.isTrue(jsOutput.contains(text), "output should contain '$text'");
diff --git a/pkg/compiler/test/inlining/meta_annotations3_test.dart b/pkg/compiler/test/inlining/meta_annotations3_test.dart
index ad42b08..1d57b01 100644
--- a/pkg/compiler/test/inlining/meta_annotations3_test.dart
+++ b/pkg/compiler/test/inlining/meta_annotations3_test.dart
@@ -8,7 +8,7 @@
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import '../helpers/memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -56,7 +56,7 @@
OutputCollector collector = new OutputCollector();
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
void has(String text) {
Expect.isTrue(jsOutput.contains(text), "output should contain '$text'");
diff --git a/pkg/compiler/test/serialization/serialization_test_helper.dart b/pkg/compiler/test/serialization/serialization_test_helper.dart
index 311d7c8..4371bd3 100644
--- a/pkg/compiler/test/serialization/serialization_test_helper.dart
+++ b/pkg/compiler/test/serialization/serialization_test_helper.dart
@@ -6,7 +6,7 @@
import 'dart:io';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/codegen.dart';
import 'package:compiler/src/compiler.dart';
@@ -39,7 +39,7 @@
}
void finishCompileAndCompare(
- Map<OutputType, Map<String, String>> expectedOutput,
+ Map<api.OutputType, Map<String, String>> expectedOutput,
OutputCollector actualOutputCollector,
Compiler compiler,
SerializationStrategy strategy,
@@ -65,14 +65,14 @@
Expect.setEquals(
expectedOutput.keys, actualOutput.keys, "Output type mismatch.");
- void check(OutputType outputType, Map<String, String> fileMap) {
+ void check(api.OutputType outputType, Map<String, String> fileMap) {
Map<String, String> newFileMap = actualOutput[outputType];
Expect.setEquals(fileMap.keys, newFileMap.keys,
"File mismatch for output type $outputType.");
fileMap.forEach((String fileName, String code) {
String newCode = newFileMap[fileName];
bool Function(int, List<String>, List<String>) filter;
- if (outputType == OutputType.dumpInfo) {
+ if (outputType == api.OutputType.dumpInfo) {
filter = (int index, List<String> lines1, List<String> lines2) {
if (index <= lines1.length && index <= lines2.length) {
String line1 = lines1[index];
@@ -120,7 +120,7 @@
compiler.forceSerializationForTesting = true;
});
Expect.isTrue(result.isSuccess);
- Map<OutputType, Map<String, String>> expectedOutput = collector.clear();
+ Map<api.OutputType, Map<String, String>> expectedOutput = collector.clear();
OutputCollector collector2 = new OutputCollector();
CompilationResult result2 = await runCompiler(
diff --git a/pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart b/pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart
index 24ad0a3..35628cd 100644
--- a/pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart
+++ b/pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart
@@ -8,9 +8,9 @@
import 'dart:async';
import 'dart:io';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/compiler.dart' as api;
+import 'package:compiler/src/compiler.dart' show Compiler;
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/io/code_output.dart';
import 'package:compiler/src/io/source_file.dart';
@@ -23,9 +23,9 @@
import 'package:compiler/src/source_file_provider.dart';
import '../../helpers/memory_compiler.dart';
-class SourceFileSink implements OutputSink {
+class SourceFileSink implements api.OutputSink {
final String filename;
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
SourceFile sourceFile;
SourceFileSink(this.filename);
@@ -41,7 +41,7 @@
}
}
-class OutputProvider implements CompilerOutput {
+class OutputProvider implements api.CompilerOutput {
Map<Uri, SourceFileSink> outputMap = <Uri, SourceFileSink>{};
SourceFile getSourceFile(Uri uri) {
@@ -53,7 +53,7 @@
}
SourceFileSink createSourceFileSink(
- String name, String extension, OutputType type) {
+ String name, String extension, api.OutputType type) {
String filename = '$name.$extension';
SourceFileSink sink = new SourceFileSink(filename);
Uri uri = Uri.parse(filename);
@@ -62,12 +62,13 @@
}
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
return createSourceFileSink(name, extension, type);
}
@override
- BinaryOutputSink createBinarySink(Uri uri) =>
+ api.BinaryOutputSink createBinarySink(Uri uri) =>
throw new UnsupportedError("OutputProvider.createBinarySink");
}
@@ -78,14 +79,16 @@
: outputProvider = new RandomAccessFileOutputProvider(jsUri, jsMapUri);
@override
- OutputSink createOutputSink(String name, String extension, OutputType type) {
- OutputSink output = outputProvider.createOutputSink(name, extension, type);
+ api.OutputSink createOutputSink(
+ String name, String extension, api.OutputType type) {
+ api.OutputSink output =
+ outputProvider.createOutputSink(name, extension, type);
return new CloningOutputSink(
[output, createSourceFileSink(name, extension, type)]);
}
@override
- BinaryOutputSink createBinarySink(Uri uri) =>
+ api.BinaryOutputSink createBinarySink(Uri uri) =>
throw new UnsupportedError("CloningOutputProvider.createBinarySink");
}
@@ -414,7 +417,7 @@
}
class SourceMaps {
- final api.Compiler compiler;
+ final Compiler compiler;
final SourceFileManager sourceFileManager;
// TODO(johnniwinther): Supported multiple output units.
final SourceMapInfo mainSourceMapInfo;
diff --git a/pkg/compiler/test/sourcemaps/mapping_test.dart b/pkg/compiler/test/sourcemaps/mapping_test.dart
index e976ff8..53d0386 100644
--- a/pkg/compiler/test/sourcemaps/mapping_test.dart
+++ b/pkg/compiler/test/sourcemaps/mapping_test.dart
@@ -9,7 +9,7 @@
import 'package:_fe_analyzer_shared/src/testing/annotated_code_helper.dart';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/expect.dart';
import 'package:source_maps/source_maps.dart';
@@ -110,11 +110,11 @@
unsafeToTouchSourceFiles: true);
Expect.isTrue(compilationResult.isSuccess,
"Unsuccessful compilation of test:\n${test.code}");
- String sourceMapText = collector.getOutput('', OutputType.sourceMap);
+ String sourceMapText = collector.getOutput('', api.OutputType.sourceMap);
SingleMapping sourceMap = parse(sourceMapText);
if (writeJs) {
new File('out.js')
- .writeAsStringSync(collector.getOutput('', OutputType.js));
+ .writeAsStringSync(collector.getOutput('', api.OutputType.js));
new File('out.js.map').writeAsStringSync(sourceMapText);
}
diff --git a/pkg/compiler/test/sourcemaps/nomapping_test.dart b/pkg/compiler/test/sourcemaps/nomapping_test.dart
index fdbd62b..dd41cca 100644
--- a/pkg/compiler/test/sourcemaps/nomapping_test.dart
+++ b/pkg/compiler/test/sourcemaps/nomapping_test.dart
@@ -8,7 +8,7 @@
import 'dart:io';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import 'package:source_maps/source_maps.dart';
@@ -73,11 +73,11 @@
options: options);
Expect.isTrue(compilationResult.isSuccess,
"Unsuccessful compilation of test:\n${code}");
- String sourceMapText = collector.getOutput('', OutputType.sourceMap);
+ String sourceMapText = collector.getOutput('', api.OutputType.sourceMap);
SingleMapping sourceMap = parse(sourceMapText);
if (writeJs) {
new File('out.js')
- .writeAsStringSync(collector.getOutput('', OutputType.js));
+ .writeAsStringSync(collector.getOutput('', api.OutputType.js));
new File('out.js.map').writeAsStringSync(sourceMapText);
}
Expect.isTrue(sourceMap.lines.isNotEmpty);
diff --git a/pkg/compiler/test/sourcemaps/source_map_test.dart b/pkg/compiler/test/sourcemaps/source_map_test.dart
index 4d2664b..5308059 100644
--- a/pkg/compiler/test/sourcemaps/source_map_test.dart
+++ b/pkg/compiler/test/sourcemaps/source_map_test.dart
@@ -10,7 +10,7 @@
library test.source_map;
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
@@ -50,14 +50,14 @@
showDiagnostics: true,
outputProvider: collector,
options: options);
- String jsOutput = collector.getOutput('', OutputType.js);
+ String jsOutput = collector.getOutput('', api.OutputType.js);
Expect.isNotNull(jsOutput);
if (mapping != null) {
find(jsOutput, '//# sourceMappingURL=$mapping', true);
} else {
find(jsOutput, '//# sourceMappingURL=', false);
}
- String jsSourceMapOutput = collector.getOutput('', OutputType.sourceMap);
+ String jsSourceMapOutput = collector.getOutput('', api.OutputType.sourceMap);
Expect.isNotNull(jsSourceMapOutput);
if (file != null) {
find(jsSourceMapOutput, '"file": "$file"', true);
diff --git a/pkg/compiler/test/tool/graph_isomorphizer/graph_isomorphizer_test.dart b/pkg/compiler/test/tool/graph_isomorphizer/graph_isomorphizer_test.dart
index cfae9dd..921be68 100644
--- a/pkg/compiler/test/tool/graph_isomorphizer/graph_isomorphizer_test.dart
+++ b/pkg/compiler/test/tool/graph_isomorphizer/graph_isomorphizer_test.dart
@@ -7,7 +7,7 @@
import 'dart:io';
import 'package:expect/expect.dart';
-import 'package:compiler/compiler.dart';
+import 'package:compiler/compiler_api.dart' as api;
import 'package:dart_style/dart_style.dart' show DartFormatter;
import '../../helpers/memory_compiler.dart';
import '../../../tool/graph_isomorphizer.dart';
@@ -81,8 +81,9 @@
memorySourceFiles: expectations,
options: ['--dump-deferred-graph=deferred_graph.txt'],
outputProvider: collector);
- var actual =
- collector.getOutput("deferred_graph.txt", OutputType.debug).split('\n');
+ var actual = collector
+ .getOutput("deferred_graph.txt", api.OutputType.debug)
+ .split('\n');
// Confirm new graph is isomorphic.
unorderedListEquals(graphFileLines, actual);
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index d71457b..0f8cabf 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -339,10 +339,10 @@
#endif // !defined(ARCH_IS_64_BIT) && !defined(FFI_UNIT_TESTS)
#elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) || \
defined(TARGET_ARCH_RISCV32)
-#if defined(ARCH_IS_64_BIT) && defined(TARGET_ARCH_ARM)
-// This is simarm_x64 or simarm_arm64, which is the only case where host/target
-// architecture mismatch is allowed. Unless, we're running FFI unit tests.
-#define IS_SIMARM_HOST64 1
+#if defined(HOST_ARCH_X64) && defined(TARGET_ARCH_ARM)
+// This is simarm_x64, which is the only case where host/target architecture
+// mismatch is allowed. Unless, we're running FFI unit tests.
+#define IS_SIMARM_X64 1
#elif !defined(ARCH_IS_32_BIT) && !defined(FFI_UNIT_TESTS)
#error Mismatched Host/Target architectures.
#endif // !defined(ARCH_IS_32_BIT) && !defined(FFI_UNIT_TESTS)
@@ -360,7 +360,7 @@
#elif defined(TARGET_ARCH_ARM)
#if !defined(HOST_ARCH_ARM)
#define TARGET_HOST_MISMATCH 1
-#if !defined(IS_SIMARM_HOST64)
+#if !defined(IS_SIMARM_X64)
#define USING_SIMULATOR 1
#endif
#endif
diff --git a/runtime/vm/compiler/assembler/disassembler_arm.cc b/runtime/vm/compiler/assembler/disassembler_arm.cc
index 4d860a5..51bb568 100644
--- a/runtime/vm/compiler/assembler/disassembler_arm.cc
+++ b/runtime/vm/compiler/assembler/disassembler_arm.cc
@@ -1512,14 +1512,14 @@
*object = NULL;
// TODO(36839): Make DecodeLoadObjectFromPoolOrThread work on simarm_x64.
-#if !defined(IS_SIMARM_HOST64)
+#if !defined(IS_SIMARM_X64)
if (!code.IsNull()) {
*object = &Object::Handle();
if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) {
*object = NULL;
}
}
-#endif // !defined(IS_SIMARM_HOST64)
+#endif // !defined(IS_SIMARM_X64)
}
#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 2ccf215..bf4c995 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -155,7 +155,7 @@
static DartInitializationState init_state_;
static void CheckOffsets() {
-#if !defined(IS_SIMARM_HOST64)
+#if !defined(IS_SIMARM_X64)
// These offsets are embedded in precompiled instructions. We need the
// compiler and the runtime to agree.
bool ok = true;
@@ -241,7 +241,7 @@
#undef CHECK_CONSTANT
#undef CHECK_OFFSET
#undef CHECK_PAYLOAD_SIZEOF
-#endif // !defined(IS_SIMARM_HOST64)
+#endif // !defined(IS_SIMARM_X64)
}
char* Dart::DartInit(const Dart_InitializeParams* params) {
diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h
index 559dc44..c564a48 100644
--- a/runtime/vm/globals.h
+++ b/runtime/vm/globals.h
@@ -112,7 +112,7 @@
#define SUPPORT_TIMELINE 1
#endif
-#if defined(ARCH_IS_64_BIT) && !defined(IS_SIMARM_HOST64)
+#if defined(ARCH_IS_64_BIT) && !defined(IS_SIMARM_X64)
#define HASH_IN_OBJECT_HEADER 1
#endif
diff --git a/tools/VERSION b/tools/VERSION
index d376cc8..5b204e6 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 41
+PRERELEASE 42
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/gn.py b/tools/gn.py
index a40302a..a89e8a3 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -67,76 +67,61 @@
return [merge(x, y) for x, y in gn_args.items()]
-# The C compiler's host.
+# Runs true if the currently executing python interpreter is running under
+# Rosetta. I.e., python3 is an x64 executable and we're on an arm64 Mac.
+def IsRosetta():
+ if platform.system() == 'Darwin':
+ p = subprocess.Popen(['sysctl', '-in', 'sysctl.proc_translated'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ output, _ = p.communicate()
+ return output.decode('utf-8').strip() == '1'
+ return False
+
+
def HostCpuForArch(arch):
- if arch.endswith('_x64'):
- return 'x64'
- if arch.endswith('_arm64'):
+ # Check for Rosetta before checking platform.machine(), as the latter
+ # returns 'x86_64' when running under Rosetta.
+ if IsRosetta():
+ if arch in ['x64', 'x64c']:
+ # Without this case, we would try to build with
+ # host_cpu="arm64"
+ # target_cpu="x64"
+ # dart_target_arch="x64"
+ # Which requires the VM to use an x64 simulator in the host
+ # arm64 binaries, and this simulator is unimplemented.
+ return 'x64'
+ else:
+ return 'arm64'
+
+ m = platform.machine()
+ if m == 'aarch64' or m == 'arm64':
return 'arm64'
- if arch.endswith('_riscv64'):
- return 'riscv64'
+ if m == 'armv7l':
+ return 'arm'
- # For each target architecture, we prefer in descending order
- # - using the same architecture for the host (supports all architectures)
- # - using a host architecture with the same word size (supports arm and riscv, which have simulators)
- # - using a host architecture with a different word size (supports only AOT and only 32-bit target on 64-bit host)
- if arch in ['ia32']:
- candidates = ['x86']
- elif arch in ['x64', 'x64c']:
- candidates = ['x64']
- elif arch in ['arm', 'simarm']:
- candidates = ['arm', 'x86', 'riscv32', 'arm64', 'x64', 'riscv64']
- elif arch in ['arm64', 'arm64c', 'simarm64', 'simarm64c']:
- candidates = ['arm64', 'x64', 'riscv64']
- elif arch in ['riscv32', 'simriscv32']:
- candidates = ['riscv32', 'arm', 'x86', 'riscv64', 'arm64', 'x64']
- elif arch in ['riscv64', 'simriscv64']:
- candidates = ['riscv64', 'arm64', 'x64']
- else:
- raise Exception("Unknown Dart architecture: %s" % arch)
-
- available = utils.HostArchitectures()
- for candidate in candidates:
- if candidate in available:
- return candidate
-
- raise Exception(
- "Failed to find a C host architecture for %s. Need one of %s but only %s are available."
- % (arch, candidates, available))
+ if arch in ['ia32', 'arm', 'simarm', 'simarm_x64', 'riscv32', 'simriscv32']:
+ return 'x86'
+ if arch in [
+ 'x64', 'arm64', 'simarm64', 'arm_x64', 'x64c', 'arm64c',
+ 'simarm64c', 'riscv64', 'simriscv64'
+ ]:
+ return 'x64'
# The C compiler's target.
def TargetCpuForArch(arch, target_os):
- # Real target architectures
- if arch in ['ia32']:
+ if arch in ['ia32', 'simarm', 'simriscv32']:
return 'x86'
- elif arch in ['x64', 'x64c']:
+ if arch in [
+ 'x64', 'simarm64', 'simarm_x64', 'simriscv64', 'x64c', 'simarm64c'
+ ]:
return 'x64'
- elif arch in ['arm', 'arm_x64', 'arm_arm64', 'arm_riscv64']:
+ if arch == 'arm_x64':
return 'arm'
- elif arch in ['arm64', 'arm64c']:
+ if arch == 'arm64c':
return 'arm64'
- elif arch in ['riscv32', 'riscv32_x64', 'riscv32_arm64', 'riscv32_riscv64']:
- return 'riscv32'
- elif arch in ['riscv64']:
- return 'riscv64'
-
- # Simulators
- if arch in ['simarm', 'simriscv32']:
- candidates = ['arm', 'riscv32', 'x86']
- elif arch in ['simarm64', 'simarm64c', 'simriscv64']:
- candidates = ['arm64', 'riscv64', 'x64']
- else:
- raise Exception("Unknown Dart architecture: %s" % arch)
-
- available = utils.HostArchitectures()
- for candidate in candidates:
- if candidate in available:
- return candidate
-
- raise Exception(
- "Failed to find a C target architecture for %s. Need one of %s but only %s are available."
- % (arch, candidates, available))
+ return arch
# The Dart compiler's target.
diff --git a/tools/utils.py b/tools/utils.py
index 6209073..2f42263 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -67,11 +67,9 @@
'arm': 'arm',
'arm64': 'arm',
'arm_x64': 'arm',
- 'arm_arm64': 'arm',
'simarm': 'ia32',
'simarm64': 'ia32',
'simarm_x64': 'ia32',
- 'simarm_arm64': 'arm',
'x64c': 'ia32',
'arm64c': 'arm',
'simarm64c': 'ia32',
@@ -151,44 +149,27 @@
return None
-# Runs true if the currently executing python interpreter is running under
-# Rosetta. I.e., python3 is an x64 executable and we're on an arm64 Mac.
-def IsRosetta():
- if platform.system() == 'Darwin':
- p = subprocess.Popen(['sysctl', '-in', 'sysctl.proc_translated'],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- output, _ = p.communicate()
- return output.decode('utf-8').strip() == '1'
- return False
-
-
-# Returns the architectures that can run on the current machine.
-def HostArchitectures():
- m = platform.machine()
- if platform.system() == 'Darwin':
- if m == 'arm64' or IsRosetta():
- # ARM64 Macs also support X64.
- return ['arm64', 'x64']
- if m == 'x86_64':
- # X64 Macs no longer support IA32.
- return ['x64']
- else:
- if m in ['aarch64', 'arm64', 'arm64e']:
- return ['arm64']
- if m in ['armv7l']:
- return ['arm']
- if m in ['i386', 'i686', 'ia32', 'x86']:
- return ['x86']
- if m in ['x64', 'x86-64', 'x86_64', 'AMD64']:
- return ['x64', 'x86']
- raise Exception('Failed to determine host architectures for %s %s',
- platform.machine(), platform.system())
-
-
# Try to guess the host architecture.
def GuessArchitecture():
- return HostArchitectures()[0]
+ os_id = platform.machine()
+ if os_id.startswith('aarch64') or os_id == 'arm64':
+ return 'arm64'
+ elif os_id.startswith('arm'):
+ return 'arm'
+ elif '64' in os_id:
+ return 'x64'
+ elif (not os_id) or (not re.match('(x|i[3-6])86', os_id) is None):
+ return 'ia32'
+ elif os_id == 'i86pc':
+ return 'ia32'
+
+ guess_os = GuessOS()
+ print('Warning: Guessing architecture {} based on os {}\n'.format(
+ os_id, guess_os))
+ if guess_os == 'win32':
+ return 'ia32'
+ return None
+
# Try to guess the number of cpus on this machine.
def GuessCpus():
@@ -261,15 +242,9 @@
def IsCrossBuild(target_os, arch):
- if target_os in [None, 'host']:
- return False
- if target_os != GuessOS():
- return True
- if arch.startswith('sim'):
- return False
- if arch in HostArchitectures():
- return False
- return True
+ host_arch = GuessArchitecture()
+ return ((GetArchFamily(host_arch) != GetArchFamily(arch)) or
+ (target_os != GuessOS()))
def GetBuildConf(mode, arch, conf_os=None, sanitizer=None):
@@ -278,8 +253,9 @@
arch.upper())
# Ask for a cross build if the host and target architectures don't match.
+ host_arch = GuessArchitecture()
cross_build = ''
- if IsCrossBuild(conf_os, arch):
+ if GetArchFamily(host_arch) != GetArchFamily(arch):
cross_build = 'X'
return '{}{}{}{}'.format(GetBuildMode(mode), GetBuildSanitizer(sanitizer),
cross_build, arch.upper())