1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-05 09:20:04 +00:00

Dart2js defaults to the new common front-end

Change-Id: Id0f69d258b010a746b56e259335185bcca7dafec
Reviewed-on: https://dart-review.googlesource.com/45143
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Sigmund Cherem 2018-03-13 19:25:59 +00:00 committed by commit-bot@chromium.org
parent 8c82c3b5fe
commit c438f8b3f4
130 changed files with 496 additions and 359 deletions

View File

@ -12,6 +12,37 @@
* Changed return type of `encode` on `AsciiCodec` and `Latin1Codec`,
and `convert` on `AsciiEncoder`, `Latin1Encoder`, to `Uint8List`.
### Tool Changes
* dart2js
* The dart2js compiler now uses the common front-end by default. This is a
step towards supporting Dart 2.0. At this time dart2js has no semantic
changes: the Dart 2.0 strong-mode semantics are not enabled, so dart2js
continues to support the Dart 1 type system. This change however lets us
start supporting new syntactic features of Dart 2.0, like optional
new/const. With this change you may notice:
* small code differences (~1% code size): some code is generated slightly
different, this is expected because the internal representation of the
program has small differences between the old and new front end.
* source-maps changes: with the new front-end, dart2js also is using a new
mechanism to generate source-map files. We don't expect big differences
here either, the new source-maps try to encode more data for locations
that are commonly used during debugging.
* some missing errors: the CFE is not complete and may not report some
static errors that the old front-end did. This is temporary. If you run
the analyzer on all your project already, you may never notice those
missing error messages.
* as announced earlier, this is the first version of dart2js that no longer
supports `dart:mirrors`.
* this is the first version of dart2js that no longer supports
`--package-root`, which long ago was deprecated in favor of `--packages`.
## 2.0.0
### Language

View File

@ -35,9 +35,7 @@ class Flags {
static const String generateCodeWithCompileTimeErrors =
'--generate-code-with-compile-time-errors';
/// Enable the unified front end, loading from .dill files, and compilation
/// using the kernel representation.
/// See [CompilerOptions.useKernel] for details.
/// TODO(sigmund): delete this flag.
static const String useKernel = '--use-kernel';
/// Temporary flag to revert to the old front-end once the new common

View File

@ -139,7 +139,7 @@ Future<api.CompilationResult> compile(List<String> argv,
bool showWarnings;
bool showHints;
bool enableColors;
bool useKernel = false;
bool useKernel = true;
Uri platformBinaries = computePlatformBinariesLocation();
// List of provided options that imply that output is expected.
List<String> optionsImplyCompilation = <String>[];
@ -287,10 +287,8 @@ Future<api.CompilationResult> compile(List<String> argv,
passThrough('--categories=${categories.join(",")}');
}
void setUseKernel(String argument) {
useKernel = true;
// TODO(sigmund): reenable hints (Issue #32111)
showHints = false;
void setUseOldFrontend(String argument) {
useKernel = false;
passThrough(argument);
}
@ -347,8 +345,8 @@ Future<api.CompilationResult> compile(List<String> argv,
new OptionHandler(
'--output-type=dart|--output-type=dart-multi|--output-type=js',
setOutputType),
new OptionHandler(Flags.useKernel, setUseKernel),
new OptionHandler(Flags.useOldFrontend, ignoreOption),
new OptionHandler(Flags.useKernel, ignoreOption),
new OptionHandler(Flags.useOldFrontend, setUseOldFrontend),
new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
new OptionHandler(Flags.verbose, setVerbose),
@ -598,6 +596,8 @@ Future<api.CompilationResult> compile(List<String> argv,
Uri script = currentDirectory.resolve(arguments[0]);
if (useKernel) {
diagnosticHandler.autoReadFileUri = true;
// TODO(sigmund): reenable hints (Issue #32111)
diagnosticHandler.showHints = showHints = false;
}
CompilerOptions compilerOptions = new CompilerOptions.parse(
entryPoint: script,

View File

@ -336,7 +336,8 @@ class CompilerOptions implements DiagnosticOptions {
outputUri: _extractUriOption(options, '--out='),
platformConfigUri:
_resolvePlatformConfigFromOptions(libraryRoot, options),
platformBinaries: platformBinaries,
platformBinaries: platformBinaries ??
_extractUriOption(options, '--platform-binaries='),
preserveComments: _hasOption(options, Flags.preserveComments),
preserveUris: _hasOption(options, Flags.preserveUris),
resolutionInputs: resolutionInputs,
@ -352,7 +353,7 @@ class CompilerOptions implements DiagnosticOptions {
trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
useContentSecurityPolicy:
_hasOption(options, Flags.useContentSecurityPolicy),
useKernel: _hasOption(options, Flags.useKernel),
useKernel: !_hasOption(options, Flags.useOldFrontend),
useFrequencyNamer:
!_hasOption(options, Flags.noFrequencyBasedMinification),
useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
@ -419,7 +420,7 @@ class CompilerOptions implements DiagnosticOptions {
bool trustPrimitives: false,
bool trustTypeAnnotations: false,
bool useContentSecurityPolicy: false,
bool useKernel: false,
bool useKernel: true,
bool useFrequencyNamer: true,
bool useMultiSourceInfo: false,
bool useNewSourceInfo: false,
@ -450,9 +451,7 @@ class CompilerOptions implements DiagnosticOptions {
}
}
if (useKernel && platformBinaries == null) {
throw new ArgumentError(
"${Flags.useKernel} is only supported in combination "
"with ${Flags.platformBinaries}");
throw new ArgumentError("Missing required ${Flags.platformBinaries}");
}
return new CompilerOptions._(entryPoint, libraryRoot, packageRoot,
packageConfig, packagesDiscoveryProvider, environment,
@ -559,7 +558,7 @@ class CompilerOptions implements DiagnosticOptions {
this.trustPrimitives: false,
this.trustTypeAnnotations: false,
this.useContentSecurityPolicy: false,
this.useKernel: false,
this.useKernel: true,
this.useFrequencyNamer: false,
this.useMultiSourceInfo: false,
this.useNewSourceInfo: false,

View File

@ -10,9 +10,9 @@ import 'memory_compiler.dart';
main() {
asyncTest(() async {
print('--test from ast---------------------------------------------------');
await test([]);
await test([Flags.useOldFrontend]);
print('--test from kernel------------------------------------------------');
await test([Flags.useKernel]);
await test([]);
});
}

View File

@ -42,7 +42,7 @@ void main() {
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
// 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);

View File

@ -60,7 +60,7 @@ main() {
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
Expect.isFalse(compiler.compilationFailed, 'Unsuccessful compilation');

View File

@ -34,7 +34,7 @@ main() {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': TEST},
outputProvider: outputCollector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorldBase closedWorld =
compiler.resolutionWorldBuilder.closedWorldForTesting;

View File

@ -20,8 +20,8 @@ main(arg) {}
main() {
runTest({bool useKernel}) async {
List<String> options = [Flags.enableCheckedMode];
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': SOURCE}, options: options);

View File

@ -23,8 +23,8 @@ const MEMORY_SOURCE_FILES = const {
Future test({bool useKernel, bool minify}) async {
OutputCollector collector = new OutputCollector();
List<String> options = <String>[];
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
if (minify) {
options.add(Flags.minify);

View File

@ -27,8 +27,8 @@ main (x, y) {
main() {
runTest({bool useKernel}) async {
var options = [Flags.trustTypeAnnotations];
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);

View File

@ -52,8 +52,8 @@ main () {
void main() {
runTest({bool useKernel}) async {
var options = [Flags.trustTypeAnnotations];
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: {'main.dart': TEST}, options: options);

View File

@ -27,7 +27,7 @@ main() {
await runCompiler(
memorySourceFiles: TEST_SOURCE,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
String generated = collector.getOutput('', OutputType.js);
Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR));
}

View File

@ -26,7 +26,7 @@ main (x, y) {
main() {
runTest({bool useKernel}) async {
var options = [Flags.enableCheckedMode];
if (useKernel) options.add(Flags.useKernel);
if (!useKernel) options.add(Flags.useOldFrontend);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
var compiler = result.compiler;

View File

@ -53,7 +53,7 @@ main() {
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
String jsOutput = collector.getOutput('', OutputType.js);
// Skip comments.

View File

@ -27,7 +27,7 @@ main() {
runTest({bool useKernel}) async {
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
var compiler = result.compiler;
var element =
compiler.backendClosedWorldForTesting.elementEnvironment.mainFunction;

View File

@ -75,8 +75,8 @@ Future<String> compile(String code,
if (trustJSInteropTypeAnnotations) {
options.add(Flags.trustJSInteropTypeAnnotations);
}
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
if (disableInlining) {
options.add(Flags.disableInlining);

View File

@ -1,7 +1,6 @@
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
analyze_dart_test: Slow, Pass
analyze_test: Slow, Pass
async_await_syntax_test: Pass # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
@ -12,6 +11,8 @@ codegen/logical_expression_test: Fail # Issue 17027
codegen/simple_function_subtype_test: Fail # simple_function_subtype_test is temporarily(?) disabled due to new method for building function type tests.
deferred_loading/deferred_loading_test: Slow, Pass
equivalence/id_equivalence_test: Pass, Slow
generate_code_with_compile_time_errors_test: RuntimeError # not supported yet with the new FE.
in_user_code_test: RuntimeError # analyze-only with CFE is not complete (Issues 32512, 32513)
inference/inference0_test: Slow, Pass
inference/inference1_test: Slow, Pass
inference/simple_inferrer_const_closure2_test: Fail # Issue 16507
@ -30,13 +31,11 @@ mirrors/library_imports_prefixed_test: Fail
mirrors/library_imports_shown_test: Fail
no_such_method_enabled_test: Pass, Slow
old_frontend/check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
old_frontend/check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/patch_test/bug: RuntimeError # Issue 21132
old_frontend/resolver_test: RuntimeError # Test must be updated given new parser recovery
packages/*: Skip # Skip packages folder
quarantined/http_test: Pass, Slow
quarantined/http_test: RuntimeError # not supported with CFE, consider deleting.
rti/rti_emission_test: Pass, Slow
rti/rti_need_test: Pass, Slow
serialization/analysis1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
@ -59,6 +58,8 @@ serialization/model5_test: Skip # Skip most serialization tests. These are very
serialization/model_1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/native_data_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/reserialization_test: Slow, RuntimeError # Issue 32149
show_package_warnings_test: RuntimeError # missing errors from the FE
sourcemaps/pub_build_validity_test: Pass, RuntimeError # Investigate: passes locally, but only fails in bots.
sourcemaps/source_mapping_invokes_test: Pass, Slow
sourcemaps/source_mapping_operators_test: Pass, Slow
sourcemaps/source_mapping_test: Pass, Slow
@ -88,8 +89,8 @@ sourcemaps/source_map_pub_build_validity_test: Pass, Slow
dart2js_batch2_test: Pass, RuntimeError # Issue 29021
[ $checked ]
codegen/value_range_test: Pass, Slow
codegen/value_range_kernel_test: Pass, Slow
codegen/value_range_test: Pass, Slow
end_to_end/exit_code_test: Pass, Slow
jsinterop/declaration_test: Slow, Pass
jsinterop/interop_anonymous_unreachable_test: Pass, Slow

View File

@ -23,7 +23,7 @@ void main() {
runTest({bool useKernel}) async {
OutputCollector collector = new OutputCollector();
var options = useKernel ? [Flags.useKernel] : [];
var options = useKernel ? [] : [Flags.useOldFrontend];
await runCompiler(
memorySourceFiles: sources, outputProvider: collector, options: options);
String mainOutput = collector.getOutput("", OutputType.js);

View File

@ -24,7 +24,7 @@ void main() {
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var outputUnitForEntity = compiler.backend.outputUnitData.outputUnitForEntity;

View File

@ -19,7 +19,7 @@ void main() {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;

View File

@ -19,7 +19,7 @@ void main() {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;

View File

@ -20,7 +20,7 @@ void main() {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
String mainOutput = collector.getOutput('', OutputType.js);
String deferredOutput = collector.getOutput('out_1', OutputType.jsPart);

View File

@ -15,7 +15,7 @@ void main() {
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var outputUnitForConstant =
compiler.backend.outputUnitData.outputUnitForConstant;

View File

@ -13,7 +13,7 @@ void main() {
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
dart2js.Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;

View File

@ -17,20 +17,16 @@ void main() {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
Compiler compiler = result.compiler;
lookupLibrary(name) {
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
}
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic lib1 = lookupLibrary("memory:lib1.dart");
var inlineMeAway = lib1.find("inlineMeAway");
var inlineMeAway = env.lookupLibraryMember(lib1, "inlineMeAway");
var ou_lib1 = outputUnitForEntity(inlineMeAway);
dynamic lib3 = lookupLibrary("memory:lib3.dart");
var sameContextInline = lib3.find("sameContextInline");
var sameContextInline = env.lookupLibraryMember(lib3, "sameContextInline");
var ou_lib3 = outputUnitForEntity(sameContextInline);
// Test that we actually got different output units.
@ -42,23 +38,25 @@ void main() {
String lib3Output =
collector.getOutput("out_${ou_lib3.name}", OutputType.jsPart);
RegExp re1 = new RegExp(r"inlined as empty");
RegExp re2 = new RegExp(r"inlined from main");
RegExp re3 = new RegExp(r"inlined from lib1");
RegExp re4 = new RegExp(r"inline same context");
// Test that inlineMeAway was inlined and its argument thus dropped.
Expect.isFalse(re1.hasMatch(mainOutput));
//
// TODO(sigmund): reenable, this commented test changed after porting
// deferred loading to the new common frontend.
// RegExp re1 = new RegExp(r"inlined as empty");
// Expect.isFalse(re1.hasMatch(mainOutput));
// Test that inlineFromMain was inlined and thus the string moved to lib1.
RegExp re2 = new RegExp(r"inlined from main");
Expect.isFalse(re2.hasMatch(mainOutput));
Expect.isTrue(re2.hasMatch(lib1Output));
// Test that inlineFromLib1 was not inlined into main.
RegExp re3 = new RegExp(r"inlined from lib1");
Expect.isFalse(re3.hasMatch(mainOutput));
Expect.isTrue(re3.hasMatch(lib1Output));
// Test that inlineSameContext was inlined into lib1.
RegExp re4 = new RegExp(r"inline same context");
Expect.isFalse(re4.hasMatch(lib3Output));
Expect.isTrue(re4.hasMatch(lib1Output));
});

View File

@ -18,11 +18,11 @@ void main() {
Compiler compiler = result.compiler;
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
dynamic lib =
compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
var f1 = lib.find("f1");
var f2 = lib.find("f2");
dynamic lib = env.lookupLibrary(Uri.parse("memory:lib.dart"));
var f1 = env.lookupLibraryMember(lib, "f1");
var f2 = env.lookupLibraryMember(lib, "f2");
Expect.notEquals(mainOutputUnit, outputUnitForEntity(f1));
Expect.equals(mainOutputUnit, outputUnitForEntity(f2));
});

View File

@ -18,11 +18,9 @@ void main() {
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
Compiler compiler = result.compiler;
lookupLibrary(name) {
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
}
var main = compiler.frontendStrategy.elementEnvironment.mainFunction;
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
var main = env.mainFunction;
Expect.isNotNull(main, "Could not find 'main'");
var outputUnitForEntity =
@ -33,14 +31,14 @@ void main() {
var classes = backend.emitter.neededClasses;
var inputElement = classes.where((e) => e.name == 'InputElement').single;
dynamic lib1 = lookupLibrary("memory:lib1.dart");
var foo1 = lib1.find("foo1");
var foo1 = env.lookupLibraryMember(lib1, "foo1");
dynamic lib2 = lookupLibrary("memory:lib2.dart");
var foo2 = lib2.find("foo2");
var foo2 = env.lookupLibraryMember(lib2, "foo2");
dynamic lib3 = lookupLibrary("memory:lib3.dart");
var foo3 = lib3.find("foo3");
var foo3 = env.lookupLibraryMember(lib3, "foo3");
dynamic lib4 = lookupLibrary("memory:lib4.dart");
var bar1 = lib4.find("bar1");
var bar2 = lib4.find("bar2");
var bar1 = env.lookupLibraryMember(lib4, "bar1");
var bar2 = env.lookupLibraryMember(lib4, "bar2");
OutputUnit ou_lib1 = outputUnitForEntity(foo1);
OutputUnit ou_lib2 = outputUnitForEntity(foo2);

View File

@ -20,19 +20,15 @@ void deferredTest1() {
asyncTest(() async {
CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
Compiler compiler = result.compiler;
lookupLibrary(name) {
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
}
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic lib1 = lookupLibrary("memory:lib1.dart");
dynamic lib2 = lookupLibrary("memory:lib2.dart");
lib1.find("foo1");
var foo2 = lib2.find("foo2");
env.lookupLibraryMember(lib1, "foo1");
var foo2 = env.lookupLibraryMember(lib2, "foo2");
Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo2));
});
@ -42,17 +38,14 @@ void deferredTest2() {
asyncTest(() async {
CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
Compiler compiler = result.compiler;
lookupLibrary(name) {
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
}
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
var a = shared.find("A");
var a = env.lookupLibraryMember(shared, "A");
Expect.equals(mainOutputUnit, outputUnitForEntity(a));
});
@ -75,10 +68,8 @@ library lib1;
import 'lib2.dart' deferred as lib2;
const def = const DeferredLibrary('lib2');
void foo1() {
lib1.loadLibrary().then((_) => lib2.foo2());
lib2.loadLibrary().then((_) => lib2.foo2());
}
""",
"lib2.dart": """

View File

@ -17,7 +17,7 @@ main() {
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isFalse(diagnostics.hasRegularMessages);
Expect.isFalse(output.hasExtraOutput);
Expect.isTrue(result.isSuccess);

View File

@ -5,7 +5,6 @@
import 'dart:async';
import 'memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/diagnostics/spannable.dart' show Spannable;
import 'package:compiler/src/elements/entities.dart'
@ -58,8 +57,7 @@ main() {
entryPoint: entryPoint,
memorySourceFiles: {'main.dill': kernelBinary},
diagnosticHandler: diagnostics,
outputProvider: output,
options: [Flags.useKernel]);
outputProvider: output);
await compiler.setupSdk();
await compiler.libraryLoader.loadLibrary(entryPoint);

View File

@ -99,8 +99,8 @@ typedef void JsonTaking(Map<String, dynamic> json);
jsonTest(String program, JsonTaking testFn, {bool useKernel}) async {
var options = ['--out=out.js', Flags.dumpInfo];
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: {'main.dart': program}, options: options);

View File

@ -28,11 +28,15 @@ const SOURCES = const {
"""
};
Future<String> provideInput(Uri uri) {
var source = SOURCES[uri.path];
Future provideInput(Uri uri) {
dynamic source = SOURCES[uri.path];
if (source == null) {
// Not one of our source files, so assume it's a built-in.
source = new File(uri.toFilePath()).readAsStringSync();
if (uri.path.endsWith('.dill')) {
source = new File(uri.toFilePath()).readAsBytesSync();
} else {
source = new File(uri.toFilePath()).readAsStringSync();
}
}
// Deliver the input asynchronously.
@ -45,9 +49,14 @@ main() {
// Find the path to sdk/ in the repo relative to this script.
Uri libraryRoot = Uri.base.resolve('sdk/');
Uri packageRoot = Uri.base.resolve('packages/');
asyncTest(() => compiler.compile(entrypoint, libraryRoot, packageRoot,
provideInput, handleDiagnostic, []).then((code) {
var platformDir = Uri.parse(Platform.resolvedExecutable).resolve('.');
asyncTest(() => compiler.compile(
entrypoint,
libraryRoot,
packageRoot,
provideInput,
handleDiagnostic,
['--platform-binaries=${platformDir}']).then((code) {
Expect.isNotNull(code);
}));
}

View File

@ -19,18 +19,29 @@ main() {
asyncTest(() async {
await test([], exitCode: 1);
await test(['foo.dart']);
await test([Flags.useKernel], exitCode: 1);
await test([Flags.useKernel, 'foo.dart']);
await test([Flags.resolveOnly, 'foo.dart'],
await test([Flags.useOldFrontend], exitCode: 1);
await test([Flags.useOldFrontend, 'foo.dart']);
await test([Flags.useOldFrontend, Flags.resolveOnly, 'foo.dart'],
resolveOnly: true, resolutionOutput: Uri.base.resolve('out.data'));
await test(['--resolution-input=bar.dart', 'foo.dart'],
await test(
[Flags.useOldFrontend, '--resolution-input=bar.dart', 'foo.dart'],
resolutionInputs: [Uri.base.resolve('bar.dart')]);
await test([Flags.resolveOnly, '--resolution-input=bar.dart', 'foo.dart'],
await test(
[
Flags.useOldFrontend,
Flags.resolveOnly,
'--resolution-input=bar.dart',
'foo.dart'
],
resolveOnly: true,
resolutionOutput: Uri.base.resolve('out.data'),
resolutionInputs: [Uri.base.resolve('bar.dart')]);
await test([Flags.resolveOnly, '--resolution-input=out.data', 'foo.dart'],
exitCode: 1);
await test([
Flags.useOldFrontend,
Flags.resolveOnly,
'--resolution-input=out.data',
'foo.dart'
], exitCode: 1);
});
}

View File

@ -241,6 +241,8 @@ Future testExitCode(
entry.compileFunc = compile;
List<String> args = new List<String>.from(options)
// TODO(sigmund): convert to support the new CFE
..add("--use-old-frontend")
..add("--library-root=${Uri.base.resolve('sdk/')}")
..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
Future result = entry.internalMain(args);

View File

@ -6,6 +6,7 @@
/// environment variable set.
import 'dart:async';
import 'dart:io';
import '../memory_source_file_helper.dart';
@ -59,6 +60,8 @@ class DummyCompilerInput implements CompilerInput {
return new Binary(uri, clientPlatform.codeUnits);
} else if (uri.toString().endsWith("dart_server.platform")) {
return new Binary(uri, serverPlatform.codeUnits);
} else if (uri.path.endsWith(".dill")) {
return new Binary(uri, new File.fromUri(uri).readAsBytesSync());
} else {
throw "should not be needed $uri";
}
@ -73,6 +76,8 @@ class DummyCompilerDiagnostics implements CompilerDiagnostics {
}
}
final platformDir = Uri.parse(Platform.resolvedExecutable).resolve('.');
class CustomCompiler extends CompilerImpl {
CustomCompiler(options, environment)
: super(
@ -81,7 +86,7 @@ class CustomCompiler extends CompilerImpl {
const DummyCompilerDiagnostics(),
new CompilerOptions.parse(
libraryRoot: Uri.base.resolve("sdk/"),
options: options,
options: ['--platform-binaries=$platformDir']..addAll(options),
environment: environment));
}

View File

@ -519,7 +519,7 @@ Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
CompiledData compiledData1 = await computeData(
entryPoint, memorySourceFiles, computeFromAst,
computeClassData: computeClassDataFromAst,
options: testOptions,
options: [Flags.useOldFrontend]..addAll(testOptions),
verbose: verbose,
forUserLibrariesOnly: forUserLibrariesOnly,
globalIds: annotations.globalData.keys);
@ -536,7 +536,7 @@ Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
CompiledData compiledData2 = await computeData(
entryPoint, memorySourceFiles, computeFromKernel,
computeClassData: computeClassDataFromKernel,
options: [Flags.useKernel]..addAll(testOptions),
options: testOptions,
verbose: verbose,
forUserLibrariesOnly: forUserLibrariesOnly,
globalIds: annotations.globalData.keys);
@ -762,7 +762,7 @@ Future<bool> compareData(
print('--from ast----------------------------------------------------------');
CompiledData data1 = await computeData(
entryPoint, memorySourceFiles, computeAstData,
options: options,
options: [Flags.useOldFrontend]..addAll(options),
forUserLibrariesOnly: forUserLibrariesOnly,
skipUnprocessedMembers: skipUnprocessedMembers,
skipFailedCompilations: skipFailedCompilations);
@ -770,7 +770,7 @@ Future<bool> compareData(
print('--from kernel-------------------------------------------------------');
CompiledData data2 = await computeData(
entryPoint, memorySourceFiles, computeIrData,
options: [Flags.useKernel]..addAll(options),
options: options,
forUserLibrariesOnly: forUserLibrariesOnly,
skipUnprocessedMembers: skipUnprocessedMembers,
skipFailedCompilations: skipFailedCompilations);

View File

@ -47,8 +47,8 @@ show(ArgResults argResults, ComputeMemberDataFunction computeAstData,
}
options = new List<String>.from(options);
if (useKernel) {
options.add(Flags.useKernel);
if (!useKernel) {
options.add(Flags.useOldFrontend);
}
if (strongMode) {
options.add(Flags.strongMode);

View File

@ -17,7 +17,7 @@ import 'output_collector.dart';
const MEMORY_SOURCE_FILES = const {
'main.dart': '''
foo() {
const list = [];
const [ new List() ];
}
main() {

View File

@ -177,7 +177,6 @@ main(List<String> args) {
Compiler compiler = await runWithD8(memorySourceFiles: {
'main.dart': SOURCE
}, options: [
Flags.useKernel,
Flags.strongMode,
Flags.disableRtiOptimization,
], expectedOutput: OUTPUT, printJs: args.contains('-v'));

View File

@ -86,8 +86,7 @@ main(args) {
main() {
asyncTest(() async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': code},
options: [Flags.useKernel, Flags.strongMode]);
memorySourceFiles: {'main.dart': code}, options: [Flags.strongMode]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
CodegenWorldBuilder worldBuilder = compiler.codegenWorldBuilder;

View File

@ -38,14 +38,19 @@ library sub.baz;
'pkg/sup/boz.dart': """
library sup.boz;
""",
'.packages': """
sub:pkg/sub/
sup:pkg/sup/
"""
};
Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async {
print("Test: $entryPoints");
CompilationResult result = await runCompiler(
entryPoints: entryPoints,
memorySourceFiles: SOURCE,
options: [Flags.analyzeOnly, Flags.analyzeAll],
packageRoot: Uri.parse('memory:pkg/'));
packageConfig: Uri.parse('memory:.packages'));
Compiler compiler = result.compiler;
expectedResults.forEach((String uri, bool expectedResult) {
dynamic element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
@ -77,8 +82,10 @@ Future runTests() async {
'dart:core': false,
'dart:async': false
});
await test(
[Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
// TODO(sigmund): compiler with CFE doesn't work when given sdk libraries as
// entrypoints (Issue XYZ).
//await test(
// [Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
await test([
Uri.parse('package:sub/bar.dart')
], {
@ -96,14 +103,14 @@ Future runTests() async {
'package:sup/boz.dart': true,
'dart:core': false
});
await test([
Uri.parse('dart:async'),
Uri.parse('package:sub/bar.dart')
], {
'package:sub/bar.dart': true,
'package:sub/baz.dart': true,
'package:sup/boz.dart': false,
'dart:core': true,
'dart:async': true
});
//await test([
// Uri.parse('dart:async'),
// Uri.parse('package:sub/bar.dart')
//], {
// 'package:sub/bar.dart': true,
// 'package:sub/baz.dart': true,
// 'package:sup/boz.dart': false,
// 'dart:core': true,
// 'dart:async': true
//});
}

View File

@ -213,7 +213,7 @@ doTest(String allocation, {bool nullify, bool useKernel}) async {
String source = generateTest(allocation);
var result = await runCompiler(
memorySourceFiles: {'main.dart': source},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var typesInferrer = compiler.globalInference.typesInferrerInternal;

View File

@ -234,7 +234,7 @@ doTest(String allocation,
String source = generateTest(allocation);
var result = await runCompiler(
memorySourceFiles: {'main.dart': source},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
TypeMask keyType, valueType;

View File

@ -761,7 +761,7 @@ runTests({bool useKernel}) async {
}
'''
},
options: useKernel ? [Flags.useKernel] : [],
options: useKernel ? [] : [Flags.useOldFrontend],
beforeRun: (compiler) => compiler.stopAfterTypeInference = true);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;

View File

@ -43,7 +43,7 @@ main() {
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld world = compiler.backendClosedWorldForTesting;

View File

@ -26,7 +26,7 @@ main() {
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;

View File

@ -44,7 +44,7 @@ void main() {
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
// 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);

View File

@ -56,7 +56,7 @@ void main() {
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
String jsOutput = collector.getOutput('', OutputType.js);
void has(String text) {

View File

@ -37,7 +37,7 @@ main() {
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorld closedWorld =
compiler.resolutionWorldBuilder.closedWorldForTesting;

View File

@ -28,7 +28,7 @@ main() {
var result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: {main: test},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;

View File

@ -95,7 +95,7 @@ main() {
var result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: {main: test},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;

View File

@ -449,9 +449,10 @@ runTestInternal(Test test, {bool useKernel}) async {
DiagnosticCollector collector = new DiagnosticCollector();
List<String> options = <String>[];
if (useKernel) {
options.add(Flags.useKernel);
// TODO(redemption): Enable inlining.
options.add(Flags.disableInlining);
} else {
options.add(Flags.useOldFrontend);
}
print('--useKernel=${useKernel}--------------------------------------------');
await runCompiler(

View File

@ -198,7 +198,11 @@ Future<ResultKind> mainInternal(List<String> args,
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
diagnosticHandler: collector,
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
options: [
Flags.useOldFrontend,
Flags.analyzeOnly,
Flags.enableAssertMessage
],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});

View File

@ -115,7 +115,11 @@ Future<ResultKind> mainInternal(List<String> args,
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
diagnosticHandler: collector,
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
options: [
Flags.useOldFrontend,
Flags.analyzeOnly,
Flags.enableAssertMessage
],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});

View File

@ -37,7 +37,11 @@ Future<Pair<Compiler, Compiler>> analyzeOnly(
CompilationResult result1 = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
options: [Flags.analyzeAll, Flags.enableAssertMessage],
options: [
Flags.useOldFrontend,
Flags.analyzeAll,
Flags.enableAssertMessage
],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
@ -49,7 +53,7 @@ Future<Pair<Compiler, Compiler>> analyzeOnly(
CompilationResult result2 = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
options: [Flags.analyzeOnly, Flags.enableAssertMessage, Flags.useKernel],
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
@ -139,7 +143,7 @@ Future<Compiler> compileWithDill(
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
options: [Flags.useKernel]..addAll(options),
options: options,
diagnosticHandler: diagnosticHandler,
outputProvider: compilerOutput,
beforeRun: (compiler) {

View File

@ -25,7 +25,7 @@ Future<jsAst.Expression> compile(String code,
Flags.disableInlining,
];
if (disableTypeInference) options.add(Flags.disableTypeInference);
if (useKernel) options.add(Flags.useKernel);
if (!useKernel) options.add(Flags.useOldFrontend);
options.addAll(extraOptions);
if (lookup is String && lookup != 'main' && !code.contains('main')) {

View File

@ -115,8 +115,9 @@ main(List<String> args) {
print(
'---- compiler from ast -----------------------------------------------');
var result =
await runCompiler(entryPoint: entryPoint, options: [Flags.analyzeOnly]);
var result = await runCompiler(
entryPoint: entryPoint,
options: [Flags.analyzeOnly, Flags.useOldFrontend]);
Compiler compiler1 = result.compiler;
Compiler compiler2 = await compileWithDill(

View File

@ -102,7 +102,7 @@ Future<ResultKind> mainInternal(List<String> args,
await runWithD8(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
options: [Flags.useKernel, Flags.enableAssertMessage],
options: [Flags.enableAssertMessage],
expectedOutput: OUTPUT);
return ResultKind.success;

View File

@ -144,7 +144,7 @@ CompilerImpl compilerFor(
PackagesDiscoveryProvider packagesDiscoveryProvider}) {
Uri libraryRoot = Uri.base.resolve('sdk/');
Uri platformBinaries;
if (options.contains(Flags.useKernel)) {
if (!options.contains(Flags.useOldFrontend)) {
platformBinaries = computePlatformBinariesLocation();
}
@ -293,7 +293,5 @@ DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
}
main() {
runCompiler(
memorySourceFiles: {'main.dart': 'main() {}'},
options: [Flags.useKernel]);
runCompiler(memorySourceFiles: {'main.dart': 'main() {}'});
}

View File

@ -6,7 +6,8 @@
// affect optimizations done on arrays.
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@ -32,7 +33,9 @@ main() {
main() {
asyncTest(() async {
var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = compiler.frontendStrategy.elementEnvironment.mainFunction;
var code = compiler.backend.getGeneratedCode(element);

View File

@ -9,12 +9,14 @@
import 'dart:async';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
Future runTest(String mainScript, test) async {
CompilationResult result = await runCompiler(
entryPoint: Uri.parse(mainScript),
memorySourceFiles: MEMORY_SOURCE_FILES);
memorySourceFiles: MEMORY_SOURCE_FILES,
options: [Flags.useOldFrontend]);
test(result.compiler);
}

View File

@ -10,6 +10,7 @@ library dart2js.test.import_mirrors;
import 'dart:async';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart'
show MessageKind, MessageTemplate;
import '../memory_compiler.dart';
@ -309,7 +310,7 @@ Future test(Map sourceFiles,
expectedPaths = [expectedPaths];
}
var collector = new DiagnosticCollector();
var options = [];
var options = [Flags.useOldFrontend];
if (verbose) {
options.add('--verbose');
}

View File

@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
import '../inference/type_mask_test_helper.dart';
@ -25,7 +26,9 @@ main() {
void main() {
asyncTest(() async {
var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = findElement(compiler, 'field');
var typesInferrer = compiler.globalInference.typesInferrerInternal;

View File

@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
import '../inference/type_mask_test_helper.dart';
@ -25,7 +26,9 @@ main() {
void main() {
asyncTest(() async {
var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = findElement(compiler, 'field');
var typesInferrer = compiler.globalInference.typesInferrerInternal;

View File

@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
@ -38,7 +39,9 @@ class Super {
void main() {
asyncTest(() async {
var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
options: [Flags.useOldFrontend]);
var compiler = result.compiler;
dynamic superclass =

View File

@ -5,6 +5,7 @@
// Test that tree-shaking hasn't been turned off.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
import 'package:compiler/src/js_backend/mirrors_analysis.dart';
@ -15,7 +16,9 @@ main() {
DiagnosticCollector collector = new DiagnosticCollector();
asyncTest(() async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
JavaScriptBackend backend = compiler.backend;
Expect.isTrue(collector.errors.isEmpty);

View File

@ -14,6 +14,7 @@ import "package:async_helper/async_helper.dart";
import '../memory_compiler.dart' show runCompiler;
import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/constants/values.dart'
show ConstantValue, TypeConstantValue;
@ -54,7 +55,7 @@ void main() {
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
options: ['--enable-experimental-mirrors']);
options: ['--enable-experimental-mirrors', Flags.useOldFrontend]);
CompilerImpl compiler = result.compiler;
JavaScriptBackend backend = compiler.backend;
print('');

View File

@ -5,6 +5,7 @@
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_new.dart';
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler, OutputCollector;
const MEMORY_SOURCE_FILES = const <String, String>{
@ -40,7 +41,7 @@ class Super {
runTest(bool preserveUris) async {
OutputCollector collector = new OutputCollector();
var options = ["--minify"];
var options = ["--minify", Flags.useOldFrontend];
if (preserveUris) options.add("--preserve-uris");
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,

View File

@ -599,7 +599,7 @@ Future testData(TestData data) async {
print(
'--test ast----------------------------------------------------------');
await runTest(
[Flags.analyzeAll],
[Flags.useOldFrontend, Flags.analyzeAll],
(Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
compiler,
constantRequired: field.isConst));
@ -607,8 +607,7 @@ Future testData(TestData data) async {
if (!skipKernelList.contains(data.name)) {
print(
'--test kernel-------------------------------------------------------');
await runTest([Flags.useKernel, Flags.analyzeOnly],
(Compiler compiler, FieldEntity field) {
await runTest([Flags.analyzeOnly], (Compiler compiler, FieldEntity field) {
KernelFrontEndStrategy frontendStrategy = compiler.frontendStrategy;
KernelToElementMap elementMap = frontendStrategy.elementMap;
return new KernelEvaluationEnvironment(elementMap, null, field,

View File

@ -9,8 +9,8 @@ import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/constants/expressions.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/compile_time_constants.dart';
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/kernel/element_map_impl.dart';
import 'package:compiler/src/elements/entities.dart';
import '../memory_compiler.dart';
import 'constant_expression_evaluate_test.dart' show MemoryEnvironment;
@ -56,7 +56,8 @@ const List<TestData> DATA = const [
const ConstantData('"foo"', ConstantExpressionKind.STRING),
const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
const ConstantData('1 == 2', ConstantExpressionKind.BINARY),
const ConstantData('1 != 2', ConstantExpressionKind.BINARY),
// TODO(sigmund): reenable (Issue 32511)
// const ConstantData('1 != 2', ConstantExpressionKind.BINARY),
const ConstantData('1 ?? 2', ConstantExpressionKind.BINARY),
const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'),
const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH),
@ -154,34 +155,35 @@ class C<U> {
const ConstantData(
'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
type: 'A<int>', fields: const {'field(A#field1)': '87'}),
const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
type: 'A<B<dynamic>>',
fields: const {
'field(A#field1)': '42',
}),
const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
type: 'A<B<int>>',
fields: const {
'field(A#field1)': '42',
}),
const ConstantData(
'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
type: 'A<B<int>>',
fields: const {
'field(A#field1)': '87',
}),
const ConstantData(
'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
type: 'A<B<double>>',
fields: const {
'field(A#field1)': '87',
}),
const ConstantData(
'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
type: 'A<int>',
fields: const {
'field(A#field1)': '42',
}),
// TODO(sigmund): reenable (Issue 32511)
//const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<B<dynamic>>',
// fields: const {
// 'field(A#field1)': '42',
// }),
//const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<B<int>>',
// fields: const {
// 'field(A#field1)': '42',
// }),
//const ConstantData(
// 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<B<int>>',
// fields: const {
// 'field(A#field1)': '87',
// }),
//const ConstantData(
// 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<B<double>>',
// fields: const {
// 'field(A#field1)': '87',
// }),
//const ConstantData(
// 'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<int>',
// fields: const {
// 'field(A#field1)': '42',
// }),
]),
];
@ -203,12 +205,17 @@ Future testData(TestData data) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']);
Compiler compiler = result.compiler;
MemoryEnvironment environment =
new MemoryEnvironment(new AstEvaluationEnvironment(compiler));
dynamic library = compiler.frontendStrategy.elementEnvironment.mainLibrary;
var elementEnvironment = compiler.frontendStrategy.elementEnvironment;
MemoryEnvironment environment = new MemoryEnvironment(
new KernelEvaluationEnvironment(
(compiler.frontendStrategy as dynamic).elementMap,
compiler.environment,
null));
dynamic library = elementEnvironment.mainLibrary;
constants.forEach((String name, ConstantData data) {
FieldElement field = library.localLookup(name);
dynamic constant = field.constant;
FieldEntity field = elementEnvironment.lookupLibraryMember(library, name);
dynamic constant = elementEnvironment.getFieldConstant(field);
Expect.equals(
data.kind,
constant.kind,
@ -237,6 +244,8 @@ Future testData(TestData data) async {
"`${constant.toDartText()}`, expected '${data.fields.length}'.");
instanceFields.forEach((field, expression) {
String name = '$field';
Expect.isTrue(name.startsWith('k:'));
name = name.substring(2).replaceAll('.', "#");
String expression = instanceFields[field].toDartText();
String expected = data.fields[name];
Expect.equals(

View File

@ -212,7 +212,7 @@ main() {
print(test.code);
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': test.code},
options: useKernel ? [Flags.useKernel] : []);
options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
checkTest(compiler, test);
}

View File

@ -34,7 +34,7 @@ Future<DiagnosticCollector> run(String source,
{bool analyzeAll, bool expectSuccess}) async {
DiagnosticCollector collector = new DiagnosticCollector();
List<String> options = [];
List<String> options = [Flags.useOldFrontend];
if (analyzeAll) {
options.add(Flags.analyzeAll);
} else {

View File

@ -31,6 +31,7 @@ main(List<String> arguments) {
bool verbose = arguments.contains('-v');
List<String> options = <String>[
Flags.useOldFrontend,
Flags.analyzeOnly,
Flags.analyzeMain,
'--categories=Client,Server'

View File

@ -232,6 +232,7 @@ Future analyze(
var provider = new CompilerSourceFileProvider();
var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider);
options = <String>[
Flags.useOldFrontend,
Flags.analyzeOnly,
'--categories=Client,Server',
Flags.showPackageWarnings

View File

@ -40,6 +40,7 @@ runCompiler(String main, List<String> options,
}
}
options = [Flags.useOldFrontend]..addAll(options);
print('-----------------------------------------------');
print('main source:\n$main');
print('options: $options\n');

View File

@ -35,7 +35,10 @@ main() {
provider,
new LegacyCompilerOutput(),
new LegacyCompilerDiagnostics(diagnosticHandler),
new CompilerOptions(libraryRoot: libraryRoot, packageRoot: packageRoot));
new CompilerOptions(
libraryRoot: libraryRoot,
useKernel: false,
packageRoot: packageRoot));
asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
Expect.isTrue(compiler.compilationFailed);
Expect.equals(5, errorCount);

View File

@ -7,6 +7,7 @@
import '../memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:compiler/src/js_backend/js_backend.dart';
@ -28,7 +29,9 @@ testExamples(MessageKind kind) async {
}
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
memorySourceFiles: example, diagnosticHandler: collector);
memorySourceFiles: example,
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Expect
.isTrue(collector.errors.any((message) => message.messageKind == kind));

View File

@ -4,6 +4,7 @@
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import "../memory_compiler.dart";
@ -11,7 +12,7 @@ runTest(String source, String categories, int expectedErrors) async {
var collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: {"main.dart": source},
options: ["--categories=$categories"],
options: ["--categories=$categories", Flags.useOldFrontend],
diagnosticHandler: collector);
Expect.equals(expectedErrors, collector.errors.length);
Expect.equals(0, collector.warnings.length);

View File

@ -5,6 +5,7 @@
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/apiimpl.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
import 'package:compiler/src/resolution/class_members.dart'
@ -14,7 +15,8 @@ import '../memory_compiler.dart';
const String DART2JS_SOURCE = 'pkg/compiler/lib/src/dart2js.dart';
const List<String> DART2JS_OPTIONS = const <String>[
'--categories=Client,Server',
'--disable-type-inference'
'--disable-type-inference',
Flags.useOldFrontend
];
Iterable<ClassEntity> computeLiveClasses(CompilerImpl compiler) {

View File

@ -44,7 +44,7 @@ Future<Compiler> test(Uri entryPoint,
print('==================================================================');
print('test: $entryPoint showPackageWarnings=$showPackageWarnings '
'suppressHints=$suppressHints');
var options = [Flags.analyzeOnly];
var options = [Flags.analyzeOnly, Flags.useOldFrontend];
if (showPackageWarnings) {
options.add(Flags.showPackageWarnings);
}

View File

@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/compiler_new.dart' show Diagnostic;
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@ -13,7 +14,7 @@ void main() {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector,
options: ['--analyze-all']);
options: ['--analyze-all', Flags.useOldFrontend]);
List<String> diagnostics = <String>[];
collector.messages.forEach((CollectedMessage message) {

View File

@ -30,7 +30,7 @@ Future test(Map<String, String> source,
memorySourceFiles: source,
diagnosticHandler: collector,
showDiagnostics: true,
options: [Flags.analyzeOnly, Flags.analyzeAll],
options: [Flags.analyzeOnly, Flags.analyzeAll, Flags.useOldFrontend],
packageRoot: Uri.parse('memory:pkg/'));
Expect.isTrue(collector.errors.isEmpty);

View File

@ -8,6 +8,7 @@ library dart2js.test.error_token;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@ -20,7 +21,8 @@ Future runTest(String code,
entryPoint: Uri.parse('memory:main.dart'),
memorySourceFiles: {'main.dart': code},
diagnosticHandler: diagnostics,
outputProvider: output);
outputProvider: output,
options: [Flags.useOldFrontend]);
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
if (error != null)

View File

@ -48,7 +48,8 @@ void check(Map<String, List<String>> testFiles,
entryPoint: Uri.parse('memory:$testFileName'),
memorySourceFiles: {testFileName: testSources[testName]},
diagnosticHandler: collector,
options: [Flags.analyzeOnly]..addAll(options),
options: [Flags.analyzeOnly, Flags.useOldFrontend]
..addAll(options),
showDiagnostics: verbose,
cachedCompiler: cachedCompiler);
var compiler = result.compiler;

View File

@ -14,6 +14,7 @@ library dart2js.test.generic_method_type_usage;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@ -90,7 +91,7 @@ Future runTest(Uri main, {MessageKind warning, MessageKind info}) async {
OutputCollector output = new OutputCollector();
await runCompiler(
entryPoint: main,
options: const <String>["--generic-method-syntax"],
options: const <String>["--generic-method-syntax", Flags.useOldFrontend],
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output);

View File

@ -8,6 +8,7 @@
library dart2js.test.import;
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import '../memory_compiler.dart';
@ -45,7 +46,8 @@ testEntryPointIsPart() async {
await runCompiler(
entryPoint: Uri.parse('memory:part.dart'),
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector);
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
collector.checkMessages([const Expected.error(MessageKind.MAIN_HAS_PART_OF)]);
}
@ -55,7 +57,8 @@ testImportPart() async {
await runCompiler(
entryPoint: Uri.parse('memory:lib.dart'),
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector);
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
collector.checkMessages([
const Expected.error(MessageKind.IMPORT_PART_OF),
@ -66,7 +69,9 @@ testImportPart() async {
testMissingImports() async {
var collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
collector.checkMessages([
const Expected.error(MessageKind.READ_URI_ERROR),
@ -81,7 +86,8 @@ testMissingMain() async {
var collector = new DiagnosticCollector();
await runCompiler(
entryPoint: Uri.parse('memory:missing.dart'),
diagnosticHandler: collector);
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
collector.checkMessages([const Expected.error(MessageKind.READ_SELF_ERROR)]);
}

View File

@ -38,7 +38,9 @@ class CustomCompiler extends CompilerImpl {
const NullCompilerOutput(),
handler,
new CompilerOptions(
libraryRoot: libraryRoot, packageConfig: packageConfig));
libraryRoot: libraryRoot,
useKernel: false,
packageConfig: packageConfig));
}
main() async {

View File

@ -9,6 +9,7 @@ library dart2js.test.malformed_uri;
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@ -23,7 +24,9 @@ testMalformedUri() {
asyncTest(() async {
var collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
Expect.equals(1, collector.errors.length);
});
}

View File

@ -7,6 +7,7 @@ library members_test;
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import '../type_test_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/elements/resolution_types.dart';
import "package:compiler/src/elements/elements.dart"
show ClassElement, MemberSignature;
@ -187,7 +188,9 @@ void testClassMembers() {
class C<S> extends B<S> {}
class D extends C<int> {}
class E extends D {}
""", compileMode: CompileMode.memory).then((env) {
""",
options: [Flags.useOldFrontend],
compileMode: CompileMode.memory).then((env) {
ResolutionInterfaceType bool_ = env['bool'];
ResolutionInterfaceType String_ = env['String'];
ResolutionInterfaceType int_ = env['int'];
@ -445,7 +448,7 @@ void testInterfaceMembers() {
num method4();
}
abstract class D implements A, B, C {}
""").then((env) {
""", options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionVoidType void_ = env['void'];
ResolutionInterfaceType num_ = env['num'];
@ -614,7 +617,7 @@ void testClassVsInterfaceMembers() {
method2(a);
}
abstract class C extends A implements B {}
""").then((env) {
""", options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionInterfaceType A = env['A'];
@ -665,7 +668,7 @@ void testMixinMembers() {
method3(S a) {}
}
abstract class C<U, V> extends Object with A<U> implements B<V> {}
""").then((env) {
""", options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ClassElement A = env.getElement('A');
@ -734,7 +737,7 @@ void testMixinMembersWithoutImplements() {
abstract class B implements A {
}
abstract class C extends Object with B {}
""").then((env) {
""", options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionInterfaceType A = env['A'];

View File

@ -69,8 +69,11 @@ Future<Compiler> check(MessageTemplate template, Compiler cachedCompiler) {
Compiler compiler = compilerFor(
memorySourceFiles: example,
diagnosticHandler: collector,
options: [Flags.analyzeOnly, Flags.enableExperimentalMirrors]
..addAll(template.options),
options: [
Flags.analyzeOnly,
Flags.enableExperimentalMirrors,
Flags.useOldFrontend
]..addAll(template.options),
cachedCompiler: cachedCompiler);
return compiler.run(Uri.parse('memory:main.dart')).then((_) {

View File

@ -146,7 +146,7 @@ main() {
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': test.code},
options: [Flags.analyzeOnly],
options: [Flags.analyzeOnly, Flags.useOldFrontend],
diagnosticHandler: collector,
cachedCompiler: cachedCompiler);
cachedCompiler = result.compiler;

View File

@ -1,4 +1,5 @@
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@ -10,7 +11,9 @@ runTest(String code,
print(code);
DiagnosticCollector collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: {'main.dart': code}, diagnosticHandler: collector);
memorySourceFiles: {'main.dart': code},
diagnosticHandler: collector,
options: [Flags.useOldFrontend]);
Expect.equals(0, collector.errors.length, "Unexpected errors.");
Expect.listEquals(
expectedWarnings,

View File

@ -5,6 +5,7 @@
// Test that elements are not needlessly required by dart2js.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/names.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/elements.dart';
@ -36,7 +37,8 @@ void checkInstantiated(Compiler compiler, ClassElement cls, bool expected) {
analyze(String code,
{bool proxyConstantComputed: false, bool deprecatedClass: false}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': code}, options: ['--analyze-only']);
memorySourceFiles: {'main.dart': code},
options: ['--analyze-only', Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
Expect.equals(

View File

@ -8,6 +8,7 @@ library dart2js.test.missing_file;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@ -36,7 +37,8 @@ Future runTest(Uri main, {MessageKind error, MessageKind info}) async {
entryPoint: main,
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output);
outputProvider: output,
options: [Flags.useOldFrontend]);
Expect.isFalse(output.hasExtraOutput);
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);

View File

@ -93,6 +93,7 @@ class MockCompiler extends Compiler {
options: new CompilerOptions(
entryPoint: new Uri(scheme: 'mock'),
libraryRoot: Uri.parse('placeholder_library_root_for_mock/'),
useKernel: false,
enableTypeAssertions: enableTypeAssertions,
enableUserAssertions: enableUserAssertions,
disableInlining: disableInlining,

View File

@ -10,6 +10,7 @@ import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/compiler.dart' show PackagesDiscoveryProvider;
import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
import 'package:package_config/packages.dart';
@ -41,7 +42,8 @@ Future runTest(Uri main, MessageKind expectedMessageKind,
diagnosticHandler: collector,
packageRoot: packageRoot,
packageConfig: packageConfig,
packagesDiscoveryProvider: packagesDiscoveryProvider);
packagesDiscoveryProvider: packagesDiscoveryProvider,
options: [Flags.useOldFrontend]);
Expect.equals(
1, collector.errors.length, "Unexpected errors: ${collector.errors}");
Expect.equals(expectedMessageKind, collector.errors.first.message.kind,

View File

@ -25,7 +25,11 @@ main(List<String> arguments) async {
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last));
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
options: [Flags.analyzeOnly, '--categories=Client,Server']);
options: [
Flags.analyzeOnly,
'--categories=Client,Server',
Flags.useOldFrontend
]);
if (result.isSuccess) {
checkRelatedTypes(result.compiler);
}

View File

@ -263,7 +263,7 @@ main(List<String> arguments) {
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
options: [Flags.analyzeOnly, Flags.analyzeMain],
options: [Flags.analyzeOnly, Flags.analyzeMain, Flags.useOldFrontend],
diagnosticHandler: collector);
Expect.isFalse(
collector.hasRegularMessages, "Unexpected analysis messages.");

View File

@ -295,7 +295,7 @@ Future test(
CompilationResult result = await runCompiler(
memorySourceFiles: sourceFiles,
options: [Flags.analyzeAll, Flags.analyzeOnly]);
options: [Flags.analyzeAll, Flags.analyzeOnly, Flags.useOldFrontend]);
Compiler compiler = result.compiler;
testMap.forEach((String filename, Test test) {
LibraryElement library =

Some files were not shown because too many files have changed in this diff Show More