mirror of
https://github.com/dart-lang/sdk
synced 2024-07-20 08:27:28 +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:
parent
8c82c3b5fe
commit
c438f8b3f4
31
CHANGELOG.md
31
CHANGELOG.md
|
@ -12,6 +12,37 @@
|
||||||
* Changed return type of `encode` on `AsciiCodec` and `Latin1Codec`,
|
* Changed return type of `encode` on `AsciiCodec` and `Latin1Codec`,
|
||||||
and `convert` on `AsciiEncoder`, `Latin1Encoder`, to `Uint8List`.
|
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
|
## 2.0.0
|
||||||
|
|
||||||
### Language
|
### Language
|
||||||
|
|
|
@ -35,9 +35,7 @@ class Flags {
|
||||||
static const String generateCodeWithCompileTimeErrors =
|
static const String generateCodeWithCompileTimeErrors =
|
||||||
'--generate-code-with-compile-time-errors';
|
'--generate-code-with-compile-time-errors';
|
||||||
|
|
||||||
/// Enable the unified front end, loading from .dill files, and compilation
|
/// TODO(sigmund): delete this flag.
|
||||||
/// using the kernel representation.
|
|
||||||
/// See [CompilerOptions.useKernel] for details.
|
|
||||||
static const String useKernel = '--use-kernel';
|
static const String useKernel = '--use-kernel';
|
||||||
|
|
||||||
/// Temporary flag to revert to the old front-end once the new common
|
/// Temporary flag to revert to the old front-end once the new common
|
||||||
|
|
|
@ -139,7 +139,7 @@ Future<api.CompilationResult> compile(List<String> argv,
|
||||||
bool showWarnings;
|
bool showWarnings;
|
||||||
bool showHints;
|
bool showHints;
|
||||||
bool enableColors;
|
bool enableColors;
|
||||||
bool useKernel = false;
|
bool useKernel = true;
|
||||||
Uri platformBinaries = computePlatformBinariesLocation();
|
Uri platformBinaries = computePlatformBinariesLocation();
|
||||||
// List of provided options that imply that output is expected.
|
// List of provided options that imply that output is expected.
|
||||||
List<String> optionsImplyCompilation = <String>[];
|
List<String> optionsImplyCompilation = <String>[];
|
||||||
|
@ -287,10 +287,8 @@ Future<api.CompilationResult> compile(List<String> argv,
|
||||||
passThrough('--categories=${categories.join(",")}');
|
passThrough('--categories=${categories.join(",")}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUseKernel(String argument) {
|
void setUseOldFrontend(String argument) {
|
||||||
useKernel = true;
|
useKernel = false;
|
||||||
// TODO(sigmund): reenable hints (Issue #32111)
|
|
||||||
showHints = false;
|
|
||||||
passThrough(argument);
|
passThrough(argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,8 +345,8 @@ Future<api.CompilationResult> compile(List<String> argv,
|
||||||
new OptionHandler(
|
new OptionHandler(
|
||||||
'--output-type=dart|--output-type=dart-multi|--output-type=js',
|
'--output-type=dart|--output-type=dart-multi|--output-type=js',
|
||||||
setOutputType),
|
setOutputType),
|
||||||
new OptionHandler(Flags.useKernel, setUseKernel),
|
new OptionHandler(Flags.useKernel, ignoreOption),
|
||||||
new OptionHandler(Flags.useOldFrontend, ignoreOption),
|
new OptionHandler(Flags.useOldFrontend, setUseOldFrontend),
|
||||||
new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
|
new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
|
||||||
new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
|
new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
|
||||||
new OptionHandler(Flags.verbose, setVerbose),
|
new OptionHandler(Flags.verbose, setVerbose),
|
||||||
|
@ -598,6 +596,8 @@ Future<api.CompilationResult> compile(List<String> argv,
|
||||||
Uri script = currentDirectory.resolve(arguments[0]);
|
Uri script = currentDirectory.resolve(arguments[0]);
|
||||||
if (useKernel) {
|
if (useKernel) {
|
||||||
diagnosticHandler.autoReadFileUri = true;
|
diagnosticHandler.autoReadFileUri = true;
|
||||||
|
// TODO(sigmund): reenable hints (Issue #32111)
|
||||||
|
diagnosticHandler.showHints = showHints = false;
|
||||||
}
|
}
|
||||||
CompilerOptions compilerOptions = new CompilerOptions.parse(
|
CompilerOptions compilerOptions = new CompilerOptions.parse(
|
||||||
entryPoint: script,
|
entryPoint: script,
|
||||||
|
|
|
@ -336,7 +336,8 @@ class CompilerOptions implements DiagnosticOptions {
|
||||||
outputUri: _extractUriOption(options, '--out='),
|
outputUri: _extractUriOption(options, '--out='),
|
||||||
platformConfigUri:
|
platformConfigUri:
|
||||||
_resolvePlatformConfigFromOptions(libraryRoot, options),
|
_resolvePlatformConfigFromOptions(libraryRoot, options),
|
||||||
platformBinaries: platformBinaries,
|
platformBinaries: platformBinaries ??
|
||||||
|
_extractUriOption(options, '--platform-binaries='),
|
||||||
preserveComments: _hasOption(options, Flags.preserveComments),
|
preserveComments: _hasOption(options, Flags.preserveComments),
|
||||||
preserveUris: _hasOption(options, Flags.preserveUris),
|
preserveUris: _hasOption(options, Flags.preserveUris),
|
||||||
resolutionInputs: resolutionInputs,
|
resolutionInputs: resolutionInputs,
|
||||||
|
@ -352,7 +353,7 @@ class CompilerOptions implements DiagnosticOptions {
|
||||||
trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
|
trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
|
||||||
useContentSecurityPolicy:
|
useContentSecurityPolicy:
|
||||||
_hasOption(options, Flags.useContentSecurityPolicy),
|
_hasOption(options, Flags.useContentSecurityPolicy),
|
||||||
useKernel: _hasOption(options, Flags.useKernel),
|
useKernel: !_hasOption(options, Flags.useOldFrontend),
|
||||||
useFrequencyNamer:
|
useFrequencyNamer:
|
||||||
!_hasOption(options, Flags.noFrequencyBasedMinification),
|
!_hasOption(options, Flags.noFrequencyBasedMinification),
|
||||||
useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
|
useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
|
||||||
|
@ -419,7 +420,7 @@ class CompilerOptions implements DiagnosticOptions {
|
||||||
bool trustPrimitives: false,
|
bool trustPrimitives: false,
|
||||||
bool trustTypeAnnotations: false,
|
bool trustTypeAnnotations: false,
|
||||||
bool useContentSecurityPolicy: false,
|
bool useContentSecurityPolicy: false,
|
||||||
bool useKernel: false,
|
bool useKernel: true,
|
||||||
bool useFrequencyNamer: true,
|
bool useFrequencyNamer: true,
|
||||||
bool useMultiSourceInfo: false,
|
bool useMultiSourceInfo: false,
|
||||||
bool useNewSourceInfo: false,
|
bool useNewSourceInfo: false,
|
||||||
|
@ -450,9 +451,7 @@ class CompilerOptions implements DiagnosticOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (useKernel && platformBinaries == null) {
|
if (useKernel && platformBinaries == null) {
|
||||||
throw new ArgumentError(
|
throw new ArgumentError("Missing required ${Flags.platformBinaries}");
|
||||||
"${Flags.useKernel} is only supported in combination "
|
|
||||||
"with ${Flags.platformBinaries}");
|
|
||||||
}
|
}
|
||||||
return new CompilerOptions._(entryPoint, libraryRoot, packageRoot,
|
return new CompilerOptions._(entryPoint, libraryRoot, packageRoot,
|
||||||
packageConfig, packagesDiscoveryProvider, environment,
|
packageConfig, packagesDiscoveryProvider, environment,
|
||||||
|
@ -559,7 +558,7 @@ class CompilerOptions implements DiagnosticOptions {
|
||||||
this.trustPrimitives: false,
|
this.trustPrimitives: false,
|
||||||
this.trustTypeAnnotations: false,
|
this.trustTypeAnnotations: false,
|
||||||
this.useContentSecurityPolicy: false,
|
this.useContentSecurityPolicy: false,
|
||||||
this.useKernel: false,
|
this.useKernel: true,
|
||||||
this.useFrequencyNamer: false,
|
this.useFrequencyNamer: false,
|
||||||
this.useMultiSourceInfo: false,
|
this.useMultiSourceInfo: false,
|
||||||
this.useNewSourceInfo: false,
|
this.useNewSourceInfo: false,
|
||||||
|
|
|
@ -10,9 +10,9 @@ import 'memory_compiler.dart';
|
||||||
main() {
|
main() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
print('--test from ast---------------------------------------------------');
|
print('--test from ast---------------------------------------------------');
|
||||||
await test([]);
|
await test([Flags.useOldFrontend]);
|
||||||
print('--test from kernel------------------------------------------------');
|
print('--test from kernel------------------------------------------------');
|
||||||
await test([Flags.useKernel]);
|
await test([]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void main() {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
// Simply check that the constants of the small functions are still in the
|
// 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.
|
// output, and that we don't see the result of constant folding.
|
||||||
String jsOutput = collector.getOutput('', OutputType.js);
|
String jsOutput = collector.getOutput('', OutputType.js);
|
||||||
|
|
|
@ -60,7 +60,7 @@ main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
|
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
Expect.isFalse(compiler.compilationFailed, 'Unsuccessful compilation');
|
Expect.isFalse(compiler.compilationFailed, 'Unsuccessful compilation');
|
||||||
|
|
|
@ -34,7 +34,7 @@ main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': TEST},
|
memorySourceFiles: {'main.dart': TEST},
|
||||||
outputProvider: outputCollector,
|
outputProvider: outputCollector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
ClosedWorldBase closedWorld =
|
ClosedWorldBase closedWorld =
|
||||||
compiler.resolutionWorldBuilder.closedWorldForTesting;
|
compiler.resolutionWorldBuilder.closedWorldForTesting;
|
||||||
|
|
|
@ -20,8 +20,8 @@ main(arg) {}
|
||||||
main() {
|
main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
List<String> options = [Flags.enableCheckedMode];
|
List<String> options = [Flags.enableCheckedMode];
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': SOURCE}, options: options);
|
memorySourceFiles: {'main.dart': SOURCE}, options: options);
|
||||||
|
|
|
@ -23,8 +23,8 @@ const MEMORY_SOURCE_FILES = const {
|
||||||
Future test({bool useKernel, bool minify}) async {
|
Future test({bool useKernel, bool minify}) async {
|
||||||
OutputCollector collector = new OutputCollector();
|
OutputCollector collector = new OutputCollector();
|
||||||
List<String> options = <String>[];
|
List<String> options = <String>[];
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
if (minify) {
|
if (minify) {
|
||||||
options.add(Flags.minify);
|
options.add(Flags.minify);
|
||||||
|
|
|
@ -27,8 +27,8 @@ main (x, y) {
|
||||||
main() {
|
main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
var options = [Flags.trustTypeAnnotations];
|
var options = [Flags.trustTypeAnnotations];
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
|
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
|
||||||
|
|
|
@ -52,8 +52,8 @@ main () {
|
||||||
void main() {
|
void main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
var options = [Flags.trustTypeAnnotations];
|
var options = [Flags.trustTypeAnnotations];
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': TEST}, options: options);
|
memorySourceFiles: {'main.dart': TEST}, options: options);
|
||||||
|
|
|
@ -27,7 +27,7 @@ main() {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: TEST_SOURCE,
|
memorySourceFiles: TEST_SOURCE,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
String generated = collector.getOutput('', OutputType.js);
|
String generated = collector.getOutput('', OutputType.js);
|
||||||
Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR));
|
Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ main (x, y) {
|
||||||
main() {
|
main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
var options = [Flags.enableCheckedMode];
|
var options = [Flags.enableCheckedMode];
|
||||||
if (useKernel) options.add(Flags.useKernel);
|
if (!useKernel) options.add(Flags.useOldFrontend);
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
|
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
|
|
|
@ -53,7 +53,7 @@ main() {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
String jsOutput = collector.getOutput('', OutputType.js);
|
String jsOutput = collector.getOutput('', OutputType.js);
|
||||||
|
|
||||||
// Skip comments.
|
// Skip comments.
|
||||||
|
|
|
@ -27,7 +27,7 @@ main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
var element =
|
var element =
|
||||||
compiler.backendClosedWorldForTesting.elementEnvironment.mainFunction;
|
compiler.backendClosedWorldForTesting.elementEnvironment.mainFunction;
|
||||||
|
|
|
@ -75,8 +75,8 @@ Future<String> compile(String code,
|
||||||
if (trustJSInteropTypeAnnotations) {
|
if (trustJSInteropTypeAnnotations) {
|
||||||
options.add(Flags.trustJSInteropTypeAnnotations);
|
options.add(Flags.trustJSInteropTypeAnnotations);
|
||||||
}
|
}
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
if (disableInlining) {
|
if (disableInlining) {
|
||||||
options.add(Flags.disableInlining);
|
options.add(Flags.disableInlining);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
# 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
|
# 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.
|
# BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
analyze_dart_test: Slow, Pass
|
analyze_dart_test: Slow, Pass
|
||||||
analyze_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.
|
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.
|
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
|
deferred_loading/deferred_loading_test: Slow, Pass
|
||||||
equivalence/id_equivalence_test: Pass, Slow
|
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/inference0_test: Slow, Pass
|
||||||
inference/inference1_test: Slow, Pass
|
inference/inference1_test: Slow, Pass
|
||||||
inference/simple_inferrer_const_closure2_test: Fail # Issue 16507
|
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
|
mirrors/library_imports_shown_test: Fail
|
||||||
no_such_method_enabled_test: Pass, Slow
|
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/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/compile_with_empty_libraries_test: Fail # Issue 24223
|
||||||
old_frontend/patch_test/bug: RuntimeError # Issue 21132
|
old_frontend/patch_test/bug: RuntimeError # Issue 21132
|
||||||
old_frontend/resolver_test: RuntimeError # Test must be updated given new parser recovery
|
old_frontend/resolver_test: RuntimeError # Test must be updated given new parser recovery
|
||||||
packages/*: Skip # Skip packages folder
|
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_emission_test: Pass, Slow
|
||||||
rti/rti_need_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.
|
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/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/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
|
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_invokes_test: Pass, Slow
|
||||||
sourcemaps/source_mapping_operators_test: Pass, Slow
|
sourcemaps/source_mapping_operators_test: Pass, Slow
|
||||||
sourcemaps/source_mapping_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
|
dart2js_batch2_test: Pass, RuntimeError # Issue 29021
|
||||||
|
|
||||||
[ $checked ]
|
[ $checked ]
|
||||||
codegen/value_range_test: Pass, Slow
|
|
||||||
codegen/value_range_kernel_test: Pass, Slow
|
codegen/value_range_kernel_test: Pass, Slow
|
||||||
|
codegen/value_range_test: Pass, Slow
|
||||||
end_to_end/exit_code_test: Pass, Slow
|
end_to_end/exit_code_test: Pass, Slow
|
||||||
jsinterop/declaration_test: Slow, Pass
|
jsinterop/declaration_test: Slow, Pass
|
||||||
jsinterop/interop_anonymous_unreachable_test: Pass, Slow
|
jsinterop/interop_anonymous_unreachable_test: Pass, Slow
|
||||||
|
|
|
@ -23,7 +23,7 @@ void main() {
|
||||||
|
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
OutputCollector collector = new OutputCollector();
|
OutputCollector collector = new OutputCollector();
|
||||||
var options = useKernel ? [Flags.useKernel] : [];
|
var options = useKernel ? [] : [Flags.useOldFrontend];
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: sources, outputProvider: collector, options: options);
|
memorySourceFiles: sources, outputProvider: collector, options: options);
|
||||||
String mainOutput = collector.getOutput("", OutputType.js);
|
String mainOutput = collector.getOutput("", OutputType.js);
|
||||||
|
|
|
@ -24,7 +24,7 @@ void main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
var outputUnitForEntity = compiler.backend.outputUnitData.outputUnitForEntity;
|
var outputUnitForEntity = compiler.backend.outputUnitData.outputUnitForEntity;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
var elementEnvironment = closedWorld.elementEnvironment;
|
var elementEnvironment = closedWorld.elementEnvironment;
|
||||||
|
|
|
@ -19,7 +19,7 @@ void main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
var elementEnvironment = closedWorld.elementEnvironment;
|
var elementEnvironment = closedWorld.elementEnvironment;
|
||||||
|
|
|
@ -20,7 +20,7 @@ void main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
String mainOutput = collector.getOutput('', OutputType.js);
|
String mainOutput = collector.getOutput('', OutputType.js);
|
||||||
String deferredOutput = collector.getOutput('out_1', OutputType.jsPart);
|
String deferredOutput = collector.getOutput('out_1', OutputType.jsPart);
|
||||||
|
|
|
@ -15,7 +15,7 @@ void main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
var outputUnitForConstant =
|
var outputUnitForConstant =
|
||||||
compiler.backend.outputUnitData.outputUnitForConstant;
|
compiler.backend.outputUnitData.outputUnitForConstant;
|
||||||
|
|
|
@ -13,7 +13,7 @@ void main() {
|
||||||
runTest({bool useKernel}) async {
|
runTest({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
dart2js.Compiler compiler = result.compiler;
|
dart2js.Compiler compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
var elementEnvironment = closedWorld.elementEnvironment;
|
var elementEnvironment = closedWorld.elementEnvironment;
|
||||||
|
|
|
@ -17,20 +17,16 @@ void main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
|
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
|
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
|
||||||
lookupLibrary(name) {
|
|
||||||
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
var outputUnitForEntity =
|
var outputUnitForEntity =
|
||||||
compiler.backend.outputUnitData.outputUnitForEntity;
|
compiler.backend.outputUnitData.outputUnitForEntity;
|
||||||
|
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
|
||||||
dynamic lib1 = lookupLibrary("memory:lib1.dart");
|
dynamic lib1 = lookupLibrary("memory:lib1.dart");
|
||||||
var inlineMeAway = lib1.find("inlineMeAway");
|
var inlineMeAway = env.lookupLibraryMember(lib1, "inlineMeAway");
|
||||||
var ou_lib1 = outputUnitForEntity(inlineMeAway);
|
var ou_lib1 = outputUnitForEntity(inlineMeAway);
|
||||||
|
|
||||||
dynamic lib3 = lookupLibrary("memory:lib3.dart");
|
dynamic lib3 = lookupLibrary("memory:lib3.dart");
|
||||||
var sameContextInline = lib3.find("sameContextInline");
|
var sameContextInline = env.lookupLibraryMember(lib3, "sameContextInline");
|
||||||
var ou_lib3 = outputUnitForEntity(sameContextInline);
|
var ou_lib3 = outputUnitForEntity(sameContextInline);
|
||||||
|
|
||||||
// Test that we actually got different output units.
|
// Test that we actually got different output units.
|
||||||
|
@ -42,23 +38,25 @@ void main() {
|
||||||
String lib3Output =
|
String lib3Output =
|
||||||
collector.getOutput("out_${ou_lib3.name}", OutputType.jsPart);
|
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.
|
// 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.
|
// 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.isFalse(re2.hasMatch(mainOutput));
|
||||||
Expect.isTrue(re2.hasMatch(lib1Output));
|
Expect.isTrue(re2.hasMatch(lib1Output));
|
||||||
|
|
||||||
// Test that inlineFromLib1 was not inlined into main.
|
// Test that inlineFromLib1 was not inlined into main.
|
||||||
|
RegExp re3 = new RegExp(r"inlined from lib1");
|
||||||
Expect.isFalse(re3.hasMatch(mainOutput));
|
Expect.isFalse(re3.hasMatch(mainOutput));
|
||||||
Expect.isTrue(re3.hasMatch(lib1Output));
|
Expect.isTrue(re3.hasMatch(lib1Output));
|
||||||
|
|
||||||
// Test that inlineSameContext was inlined into lib1.
|
// Test that inlineSameContext was inlined into lib1.
|
||||||
|
RegExp re4 = new RegExp(r"inline same context");
|
||||||
Expect.isFalse(re4.hasMatch(lib3Output));
|
Expect.isFalse(re4.hasMatch(lib3Output));
|
||||||
Expect.isTrue(re4.hasMatch(lib1Output));
|
Expect.isTrue(re4.hasMatch(lib1Output));
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,11 +18,11 @@ void main() {
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
var outputUnitForEntity =
|
var outputUnitForEntity =
|
||||||
compiler.backend.outputUnitData.outputUnitForEntity;
|
compiler.backend.outputUnitData.outputUnitForEntity;
|
||||||
|
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
|
||||||
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
|
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
|
||||||
dynamic lib =
|
dynamic lib = env.lookupLibrary(Uri.parse("memory:lib.dart"));
|
||||||
compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
|
var f1 = env.lookupLibraryMember(lib, "f1");
|
||||||
var f1 = lib.find("f1");
|
var f2 = env.lookupLibraryMember(lib, "f2");
|
||||||
var f2 = lib.find("f2");
|
|
||||||
Expect.notEquals(mainOutputUnit, outputUnitForEntity(f1));
|
Expect.notEquals(mainOutputUnit, outputUnitForEntity(f1));
|
||||||
Expect.equals(mainOutputUnit, outputUnitForEntity(f2));
|
Expect.equals(mainOutputUnit, outputUnitForEntity(f2));
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,11 +18,9 @@ void main() {
|
||||||
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
|
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
|
|
||||||
lookupLibrary(name) {
|
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
|
||||||
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
|
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
|
||||||
}
|
var main = env.mainFunction;
|
||||||
|
|
||||||
var main = compiler.frontendStrategy.elementEnvironment.mainFunction;
|
|
||||||
Expect.isNotNull(main, "Could not find 'main'");
|
Expect.isNotNull(main, "Could not find 'main'");
|
||||||
|
|
||||||
var outputUnitForEntity =
|
var outputUnitForEntity =
|
||||||
|
@ -33,14 +31,14 @@ void main() {
|
||||||
var classes = backend.emitter.neededClasses;
|
var classes = backend.emitter.neededClasses;
|
||||||
var inputElement = classes.where((e) => e.name == 'InputElement').single;
|
var inputElement = classes.where((e) => e.name == 'InputElement').single;
|
||||||
dynamic lib1 = lookupLibrary("memory:lib1.dart");
|
dynamic lib1 = lookupLibrary("memory:lib1.dart");
|
||||||
var foo1 = lib1.find("foo1");
|
var foo1 = env.lookupLibraryMember(lib1, "foo1");
|
||||||
dynamic lib2 = lookupLibrary("memory:lib2.dart");
|
dynamic lib2 = lookupLibrary("memory:lib2.dart");
|
||||||
var foo2 = lib2.find("foo2");
|
var foo2 = env.lookupLibraryMember(lib2, "foo2");
|
||||||
dynamic lib3 = lookupLibrary("memory:lib3.dart");
|
dynamic lib3 = lookupLibrary("memory:lib3.dart");
|
||||||
var foo3 = lib3.find("foo3");
|
var foo3 = env.lookupLibraryMember(lib3, "foo3");
|
||||||
dynamic lib4 = lookupLibrary("memory:lib4.dart");
|
dynamic lib4 = lookupLibrary("memory:lib4.dart");
|
||||||
var bar1 = lib4.find("bar1");
|
var bar1 = env.lookupLibraryMember(lib4, "bar1");
|
||||||
var bar2 = lib4.find("bar2");
|
var bar2 = env.lookupLibraryMember(lib4, "bar2");
|
||||||
|
|
||||||
OutputUnit ou_lib1 = outputUnitForEntity(foo1);
|
OutputUnit ou_lib1 = outputUnitForEntity(foo1);
|
||||||
OutputUnit ou_lib2 = outputUnitForEntity(foo2);
|
OutputUnit ou_lib2 = outputUnitForEntity(foo2);
|
||||||
|
|
|
@ -20,19 +20,15 @@ void deferredTest1() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
|
CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
|
|
||||||
lookupLibrary(name) {
|
|
||||||
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
var outputUnitForEntity =
|
var outputUnitForEntity =
|
||||||
compiler.backend.outputUnitData.outputUnitForEntity;
|
compiler.backend.outputUnitData.outputUnitForEntity;
|
||||||
|
|
||||||
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
|
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 lib1 = lookupLibrary("memory:lib1.dart");
|
||||||
dynamic lib2 = lookupLibrary("memory:lib2.dart");
|
dynamic lib2 = lookupLibrary("memory:lib2.dart");
|
||||||
lib1.find("foo1");
|
env.lookupLibraryMember(lib1, "foo1");
|
||||||
var foo2 = lib2.find("foo2");
|
var foo2 = env.lookupLibraryMember(lib2, "foo2");
|
||||||
|
|
||||||
Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo2));
|
Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo2));
|
||||||
});
|
});
|
||||||
|
@ -42,17 +38,14 @@ void deferredTest2() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
|
CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
|
|
||||||
lookupLibrary(name) {
|
|
||||||
return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
var outputUnitForEntity =
|
var outputUnitForEntity =
|
||||||
compiler.backend.outputUnitData.outputUnitForEntity;
|
compiler.backend.outputUnitData.outputUnitForEntity;
|
||||||
|
|
||||||
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
|
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
|
||||||
|
var env = compiler.backendClosedWorldForTesting.elementEnvironment;
|
||||||
|
lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
|
||||||
dynamic shared = lookupLibrary("memory:shared.dart");
|
dynamic shared = lookupLibrary("memory:shared.dart");
|
||||||
var a = shared.find("A");
|
var a = env.lookupLibraryMember(shared, "A");
|
||||||
|
|
||||||
Expect.equals(mainOutputUnit, outputUnitForEntity(a));
|
Expect.equals(mainOutputUnit, outputUnitForEntity(a));
|
||||||
});
|
});
|
||||||
|
@ -75,10 +68,8 @@ library lib1;
|
||||||
|
|
||||||
import 'lib2.dart' deferred as lib2;
|
import 'lib2.dart' deferred as lib2;
|
||||||
|
|
||||||
const def = const DeferredLibrary('lib2');
|
|
||||||
|
|
||||||
void foo1() {
|
void foo1() {
|
||||||
lib1.loadLibrary().then((_) => lib2.foo2());
|
lib2.loadLibrary().then((_) => lib2.foo2());
|
||||||
}
|
}
|
||||||
""",
|
""",
|
||||||
"lib2.dart": """
|
"lib2.dart": """
|
||||||
|
|
|
@ -17,7 +17,7 @@ main() {
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: diagnostics,
|
diagnosticHandler: diagnostics,
|
||||||
outputProvider: output,
|
outputProvider: output,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isFalse(diagnostics.hasRegularMessages);
|
Expect.isFalse(diagnostics.hasRegularMessages);
|
||||||
Expect.isFalse(output.hasExtraOutput);
|
Expect.isFalse(output.hasExtraOutput);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'memory_compiler.dart';
|
import 'memory_compiler.dart';
|
||||||
import 'package:async_helper/async_helper.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/common_elements.dart';
|
||||||
import 'package:compiler/src/diagnostics/spannable.dart' show Spannable;
|
import 'package:compiler/src/diagnostics/spannable.dart' show Spannable;
|
||||||
import 'package:compiler/src/elements/entities.dart'
|
import 'package:compiler/src/elements/entities.dart'
|
||||||
|
@ -58,8 +57,7 @@ main() {
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: {'main.dill': kernelBinary},
|
memorySourceFiles: {'main.dill': kernelBinary},
|
||||||
diagnosticHandler: diagnostics,
|
diagnosticHandler: diagnostics,
|
||||||
outputProvider: output,
|
outputProvider: output);
|
||||||
options: [Flags.useKernel]);
|
|
||||||
await compiler.setupSdk();
|
await compiler.setupSdk();
|
||||||
await compiler.libraryLoader.loadLibrary(entryPoint);
|
await compiler.libraryLoader.loadLibrary(entryPoint);
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,8 @@ typedef void JsonTaking(Map<String, dynamic> json);
|
||||||
|
|
||||||
jsonTest(String program, JsonTaking testFn, {bool useKernel}) async {
|
jsonTest(String program, JsonTaking testFn, {bool useKernel}) async {
|
||||||
var options = ['--out=out.js', Flags.dumpInfo];
|
var options = ['--out=out.js', Flags.dumpInfo];
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': program}, options: options);
|
memorySourceFiles: {'main.dart': program}, options: options);
|
||||||
|
|
|
@ -28,12 +28,16 @@ const SOURCES = const {
|
||||||
"""
|
"""
|
||||||
};
|
};
|
||||||
|
|
||||||
Future<String> provideInput(Uri uri) {
|
Future provideInput(Uri uri) {
|
||||||
var source = SOURCES[uri.path];
|
dynamic source = SOURCES[uri.path];
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
// Not one of our source files, so assume it's a built-in.
|
// Not one of our source files, so assume it's a built-in.
|
||||||
|
if (uri.path.endsWith('.dill')) {
|
||||||
|
source = new File(uri.toFilePath()).readAsBytesSync();
|
||||||
|
} else {
|
||||||
source = new File(uri.toFilePath()).readAsStringSync();
|
source = new File(uri.toFilePath()).readAsStringSync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Deliver the input asynchronously.
|
// Deliver the input asynchronously.
|
||||||
return new Future(() => source);
|
return new Future(() => source);
|
||||||
|
@ -45,9 +49,14 @@ main() {
|
||||||
// Find the path to sdk/ in the repo relative to this script.
|
// Find the path to sdk/ in the repo relative to this script.
|
||||||
Uri libraryRoot = Uri.base.resolve('sdk/');
|
Uri libraryRoot = Uri.base.resolve('sdk/');
|
||||||
Uri packageRoot = Uri.base.resolve('packages/');
|
Uri packageRoot = Uri.base.resolve('packages/');
|
||||||
|
var platformDir = Uri.parse(Platform.resolvedExecutable).resolve('.');
|
||||||
asyncTest(() => compiler.compile(entrypoint, libraryRoot, packageRoot,
|
asyncTest(() => compiler.compile(
|
||||||
provideInput, handleDiagnostic, []).then((code) {
|
entrypoint,
|
||||||
|
libraryRoot,
|
||||||
|
packageRoot,
|
||||||
|
provideInput,
|
||||||
|
handleDiagnostic,
|
||||||
|
['--platform-binaries=${platformDir}']).then((code) {
|
||||||
Expect.isNotNull(code);
|
Expect.isNotNull(code);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,29 @@ main() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
await test([], exitCode: 1);
|
await test([], exitCode: 1);
|
||||||
await test(['foo.dart']);
|
await test(['foo.dart']);
|
||||||
await test([Flags.useKernel], exitCode: 1);
|
await test([Flags.useOldFrontend], exitCode: 1);
|
||||||
await test([Flags.useKernel, 'foo.dart']);
|
await test([Flags.useOldFrontend, 'foo.dart']);
|
||||||
await test([Flags.resolveOnly, 'foo.dart'],
|
await test([Flags.useOldFrontend, Flags.resolveOnly, 'foo.dart'],
|
||||||
resolveOnly: true, resolutionOutput: Uri.base.resolve('out.data'));
|
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')]);
|
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,
|
resolveOnly: true,
|
||||||
resolutionOutput: Uri.base.resolve('out.data'),
|
resolutionOutput: Uri.base.resolve('out.data'),
|
||||||
resolutionInputs: [Uri.base.resolve('bar.dart')]);
|
resolutionInputs: [Uri.base.resolve('bar.dart')]);
|
||||||
await test([Flags.resolveOnly, '--resolution-input=out.data', 'foo.dart'],
|
await test([
|
||||||
exitCode: 1);
|
Flags.useOldFrontend,
|
||||||
|
Flags.resolveOnly,
|
||||||
|
'--resolution-input=out.data',
|
||||||
|
'foo.dart'
|
||||||
|
], exitCode: 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,8 @@ Future testExitCode(
|
||||||
entry.compileFunc = compile;
|
entry.compileFunc = compile;
|
||||||
|
|
||||||
List<String> args = new List<String>.from(options)
|
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("--library-root=${Uri.base.resolve('sdk/')}")
|
||||||
..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
|
..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
|
||||||
Future result = entry.internalMain(args);
|
Future result = entry.internalMain(args);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
/// environment variable set.
|
/// environment variable set.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import '../memory_source_file_helper.dart';
|
import '../memory_source_file_helper.dart';
|
||||||
|
|
||||||
|
@ -59,6 +60,8 @@ class DummyCompilerInput implements CompilerInput {
|
||||||
return new Binary(uri, clientPlatform.codeUnits);
|
return new Binary(uri, clientPlatform.codeUnits);
|
||||||
} else if (uri.toString().endsWith("dart_server.platform")) {
|
} else if (uri.toString().endsWith("dart_server.platform")) {
|
||||||
return new Binary(uri, serverPlatform.codeUnits);
|
return new Binary(uri, serverPlatform.codeUnits);
|
||||||
|
} else if (uri.path.endsWith(".dill")) {
|
||||||
|
return new Binary(uri, new File.fromUri(uri).readAsBytesSync());
|
||||||
} else {
|
} else {
|
||||||
throw "should not be needed $uri";
|
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 {
|
class CustomCompiler extends CompilerImpl {
|
||||||
CustomCompiler(options, environment)
|
CustomCompiler(options, environment)
|
||||||
: super(
|
: super(
|
||||||
|
@ -81,7 +86,7 @@ class CustomCompiler extends CompilerImpl {
|
||||||
const DummyCompilerDiagnostics(),
|
const DummyCompilerDiagnostics(),
|
||||||
new CompilerOptions.parse(
|
new CompilerOptions.parse(
|
||||||
libraryRoot: Uri.base.resolve("sdk/"),
|
libraryRoot: Uri.base.resolve("sdk/"),
|
||||||
options: options,
|
options: ['--platform-binaries=$platformDir']..addAll(options),
|
||||||
environment: environment));
|
environment: environment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
|
||||||
CompiledData compiledData1 = await computeData(
|
CompiledData compiledData1 = await computeData(
|
||||||
entryPoint, memorySourceFiles, computeFromAst,
|
entryPoint, memorySourceFiles, computeFromAst,
|
||||||
computeClassData: computeClassDataFromAst,
|
computeClassData: computeClassDataFromAst,
|
||||||
options: testOptions,
|
options: [Flags.useOldFrontend]..addAll(testOptions),
|
||||||
verbose: verbose,
|
verbose: verbose,
|
||||||
forUserLibrariesOnly: forUserLibrariesOnly,
|
forUserLibrariesOnly: forUserLibrariesOnly,
|
||||||
globalIds: annotations.globalData.keys);
|
globalIds: annotations.globalData.keys);
|
||||||
|
@ -536,7 +536,7 @@ Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
|
||||||
CompiledData compiledData2 = await computeData(
|
CompiledData compiledData2 = await computeData(
|
||||||
entryPoint, memorySourceFiles, computeFromKernel,
|
entryPoint, memorySourceFiles, computeFromKernel,
|
||||||
computeClassData: computeClassDataFromKernel,
|
computeClassData: computeClassDataFromKernel,
|
||||||
options: [Flags.useKernel]..addAll(testOptions),
|
options: testOptions,
|
||||||
verbose: verbose,
|
verbose: verbose,
|
||||||
forUserLibrariesOnly: forUserLibrariesOnly,
|
forUserLibrariesOnly: forUserLibrariesOnly,
|
||||||
globalIds: annotations.globalData.keys);
|
globalIds: annotations.globalData.keys);
|
||||||
|
@ -762,7 +762,7 @@ Future<bool> compareData(
|
||||||
print('--from ast----------------------------------------------------------');
|
print('--from ast----------------------------------------------------------');
|
||||||
CompiledData data1 = await computeData(
|
CompiledData data1 = await computeData(
|
||||||
entryPoint, memorySourceFiles, computeAstData,
|
entryPoint, memorySourceFiles, computeAstData,
|
||||||
options: options,
|
options: [Flags.useOldFrontend]..addAll(options),
|
||||||
forUserLibrariesOnly: forUserLibrariesOnly,
|
forUserLibrariesOnly: forUserLibrariesOnly,
|
||||||
skipUnprocessedMembers: skipUnprocessedMembers,
|
skipUnprocessedMembers: skipUnprocessedMembers,
|
||||||
skipFailedCompilations: skipFailedCompilations);
|
skipFailedCompilations: skipFailedCompilations);
|
||||||
|
@ -770,7 +770,7 @@ Future<bool> compareData(
|
||||||
print('--from kernel-------------------------------------------------------');
|
print('--from kernel-------------------------------------------------------');
|
||||||
CompiledData data2 = await computeData(
|
CompiledData data2 = await computeData(
|
||||||
entryPoint, memorySourceFiles, computeIrData,
|
entryPoint, memorySourceFiles, computeIrData,
|
||||||
options: [Flags.useKernel]..addAll(options),
|
options: options,
|
||||||
forUserLibrariesOnly: forUserLibrariesOnly,
|
forUserLibrariesOnly: forUserLibrariesOnly,
|
||||||
skipUnprocessedMembers: skipUnprocessedMembers,
|
skipUnprocessedMembers: skipUnprocessedMembers,
|
||||||
skipFailedCompilations: skipFailedCompilations);
|
skipFailedCompilations: skipFailedCompilations);
|
||||||
|
|
|
@ -47,8 +47,8 @@ show(ArgResults argResults, ComputeMemberDataFunction computeAstData,
|
||||||
}
|
}
|
||||||
|
|
||||||
options = new List<String>.from(options);
|
options = new List<String>.from(options);
|
||||||
if (useKernel) {
|
if (!useKernel) {
|
||||||
options.add(Flags.useKernel);
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
if (strongMode) {
|
if (strongMode) {
|
||||||
options.add(Flags.strongMode);
|
options.add(Flags.strongMode);
|
||||||
|
|
|
@ -17,7 +17,7 @@ import 'output_collector.dart';
|
||||||
const MEMORY_SOURCE_FILES = const {
|
const MEMORY_SOURCE_FILES = const {
|
||||||
'main.dart': '''
|
'main.dart': '''
|
||||||
foo() {
|
foo() {
|
||||||
const list = [];
|
const [ new List() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
|
@ -177,7 +177,6 @@ main(List<String> args) {
|
||||||
Compiler compiler = await runWithD8(memorySourceFiles: {
|
Compiler compiler = await runWithD8(memorySourceFiles: {
|
||||||
'main.dart': SOURCE
|
'main.dart': SOURCE
|
||||||
}, options: [
|
}, options: [
|
||||||
Flags.useKernel,
|
|
||||||
Flags.strongMode,
|
Flags.strongMode,
|
||||||
Flags.disableRtiOptimization,
|
Flags.disableRtiOptimization,
|
||||||
], expectedOutput: OUTPUT, printJs: args.contains('-v'));
|
], expectedOutput: OUTPUT, printJs: args.contains('-v'));
|
||||||
|
|
|
@ -86,8 +86,7 @@ main(args) {
|
||||||
main() {
|
main() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': code},
|
memorySourceFiles: {'main.dart': code}, options: [Flags.strongMode]);
|
||||||
options: [Flags.useKernel, Flags.strongMode]);
|
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
CodegenWorldBuilder worldBuilder = compiler.codegenWorldBuilder;
|
CodegenWorldBuilder worldBuilder = compiler.codegenWorldBuilder;
|
||||||
|
|
|
@ -38,14 +38,19 @@ library sub.baz;
|
||||||
'pkg/sup/boz.dart': """
|
'pkg/sup/boz.dart': """
|
||||||
library sup.boz;
|
library sup.boz;
|
||||||
""",
|
""",
|
||||||
|
'.packages': """
|
||||||
|
sub:pkg/sub/
|
||||||
|
sup:pkg/sup/
|
||||||
|
"""
|
||||||
};
|
};
|
||||||
|
|
||||||
Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async {
|
Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async {
|
||||||
|
print("Test: $entryPoints");
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
entryPoints: entryPoints,
|
entryPoints: entryPoints,
|
||||||
memorySourceFiles: SOURCE,
|
memorySourceFiles: SOURCE,
|
||||||
options: [Flags.analyzeOnly, Flags.analyzeAll],
|
options: [Flags.analyzeOnly, Flags.analyzeAll],
|
||||||
packageRoot: Uri.parse('memory:pkg/'));
|
packageConfig: Uri.parse('memory:.packages'));
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
expectedResults.forEach((String uri, bool expectedResult) {
|
expectedResults.forEach((String uri, bool expectedResult) {
|
||||||
dynamic element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
|
dynamic element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
|
||||||
|
@ -77,8 +82,10 @@ Future runTests() async {
|
||||||
'dart:core': false,
|
'dart:core': false,
|
||||||
'dart:async': false
|
'dart:async': false
|
||||||
});
|
});
|
||||||
await test(
|
// TODO(sigmund): compiler with CFE doesn't work when given sdk libraries as
|
||||||
[Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
|
// entrypoints (Issue XYZ).
|
||||||
|
//await test(
|
||||||
|
// [Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
|
||||||
await test([
|
await test([
|
||||||
Uri.parse('package:sub/bar.dart')
|
Uri.parse('package:sub/bar.dart')
|
||||||
], {
|
], {
|
||||||
|
@ -96,14 +103,14 @@ Future runTests() async {
|
||||||
'package:sup/boz.dart': true,
|
'package:sup/boz.dart': true,
|
||||||
'dart:core': false
|
'dart:core': false
|
||||||
});
|
});
|
||||||
await test([
|
//await test([
|
||||||
Uri.parse('dart:async'),
|
// Uri.parse('dart:async'),
|
||||||
Uri.parse('package:sub/bar.dart')
|
// Uri.parse('package:sub/bar.dart')
|
||||||
], {
|
//], {
|
||||||
'package:sub/bar.dart': true,
|
// 'package:sub/bar.dart': true,
|
||||||
'package:sub/baz.dart': true,
|
// 'package:sub/baz.dart': true,
|
||||||
'package:sup/boz.dart': false,
|
// 'package:sup/boz.dart': false,
|
||||||
'dart:core': true,
|
// 'dart:core': true,
|
||||||
'dart:async': true
|
// 'dart:async': true
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ doTest(String allocation, {bool nullify, bool useKernel}) async {
|
||||||
String source = generateTest(allocation);
|
String source = generateTest(allocation);
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': source},
|
memorySourceFiles: {'main.dart': source},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
||||||
|
|
|
@ -234,7 +234,7 @@ doTest(String allocation,
|
||||||
String source = generateTest(allocation);
|
String source = generateTest(allocation);
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': source},
|
memorySourceFiles: {'main.dart': source},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
TypeMask keyType, valueType;
|
TypeMask keyType, valueType;
|
||||||
|
|
|
@ -761,7 +761,7 @@ runTests({bool useKernel}) async {
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
},
|
},
|
||||||
options: useKernel ? [Flags.useKernel] : [],
|
options: useKernel ? [] : [Flags.useOldFrontend],
|
||||||
beforeRun: (compiler) => compiler.stopAfterTypeInference = true);
|
beforeRun: (compiler) => compiler.stopAfterTypeInference = true);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
|
|
|
@ -43,7 +43,7 @@ main() {
|
||||||
runTests({bool useKernel}) async {
|
runTests({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': CODE},
|
memorySourceFiles: {'main.dart': CODE},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
ClosedWorld world = compiler.backendClosedWorldForTesting;
|
ClosedWorld world = compiler.backendClosedWorldForTesting;
|
||||||
|
|
|
@ -26,7 +26,7 @@ main() {
|
||||||
runTests({bool useKernel}) async {
|
runTests({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': CODE},
|
memorySourceFiles: {'main.dart': CODE},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
|
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void main() {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
// Simply check that the constants of the small functions are still in the
|
// 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.
|
// output, and that we don't see the result of constant folding.
|
||||||
String jsOutput = collector.getOutput('', OutputType.js);
|
String jsOutput = collector.getOutput('', OutputType.js);
|
||||||
|
|
|
@ -56,7 +56,7 @@ void main() {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
outputProvider: collector,
|
outputProvider: collector,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
String jsOutput = collector.getOutput('', OutputType.js);
|
String jsOutput = collector.getOutput('', OutputType.js);
|
||||||
|
|
||||||
void has(String text) {
|
void has(String text) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ main() {
|
||||||
runTests({bool useKernel}) async {
|
runTests({bool useKernel}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
ClosedWorld closedWorld =
|
ClosedWorld closedWorld =
|
||||||
compiler.resolutionWorldBuilder.closedWorldForTesting;
|
compiler.resolutionWorldBuilder.closedWorldForTesting;
|
||||||
|
|
|
@ -28,7 +28,7 @@ main() {
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: {main: test},
|
memorySourceFiles: {main: test},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
|
|
|
@ -95,7 +95,7 @@ main() {
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: {main: test},
|
memorySourceFiles: {main: test},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
var closedWorld = compiler.backendClosedWorldForTesting;
|
var closedWorld = compiler.backendClosedWorldForTesting;
|
||||||
|
|
|
@ -449,9 +449,10 @@ runTestInternal(Test test, {bool useKernel}) async {
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
List<String> options = <String>[];
|
List<String> options = <String>[];
|
||||||
if (useKernel) {
|
if (useKernel) {
|
||||||
options.add(Flags.useKernel);
|
|
||||||
// TODO(redemption): Enable inlining.
|
// TODO(redemption): Enable inlining.
|
||||||
options.add(Flags.disableInlining);
|
options.add(Flags.disableInlining);
|
||||||
|
} else {
|
||||||
|
options.add(Flags.useOldFrontend);
|
||||||
}
|
}
|
||||||
print('--useKernel=${useKernel}--------------------------------------------');
|
print('--useKernel=${useKernel}--------------------------------------------');
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
|
|
|
@ -198,7 +198,11 @@ Future<ResultKind> mainInternal(List<String> args,
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: memorySourceFiles,
|
memorySourceFiles: memorySourceFiles,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
|
options: [
|
||||||
|
Flags.useOldFrontend,
|
||||||
|
Flags.analyzeOnly,
|
||||||
|
Flags.enableAssertMessage
|
||||||
|
],
|
||||||
beforeRun: (compiler) {
|
beforeRun: (compiler) {
|
||||||
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -115,7 +115,11 @@ Future<ResultKind> mainInternal(List<String> args,
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
|
options: [
|
||||||
|
Flags.useOldFrontend,
|
||||||
|
Flags.analyzeOnly,
|
||||||
|
Flags.enableAssertMessage
|
||||||
|
],
|
||||||
beforeRun: (compiler) {
|
beforeRun: (compiler) {
|
||||||
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,11 @@ Future<Pair<Compiler, Compiler>> analyzeOnly(
|
||||||
CompilationResult result1 = await runCompiler(
|
CompilationResult result1 = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: memorySourceFiles,
|
memorySourceFiles: memorySourceFiles,
|
||||||
options: [Flags.analyzeAll, Flags.enableAssertMessage],
|
options: [
|
||||||
|
Flags.useOldFrontend,
|
||||||
|
Flags.analyzeAll,
|
||||||
|
Flags.enableAssertMessage
|
||||||
|
],
|
||||||
beforeRun: (compiler) {
|
beforeRun: (compiler) {
|
||||||
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
||||||
});
|
});
|
||||||
|
@ -49,7 +53,7 @@ Future<Pair<Compiler, Compiler>> analyzeOnly(
|
||||||
CompilationResult result2 = await runCompiler(
|
CompilationResult result2 = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: memorySourceFiles,
|
memorySourceFiles: memorySourceFiles,
|
||||||
options: [Flags.analyzeOnly, Flags.enableAssertMessage, Flags.useKernel],
|
options: [Flags.analyzeOnly, Flags.enableAssertMessage],
|
||||||
beforeRun: (compiler) {
|
beforeRun: (compiler) {
|
||||||
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
compiler.impactCacheDeleter.retainCachesForTesting = true;
|
||||||
});
|
});
|
||||||
|
@ -139,7 +143,7 @@ Future<Compiler> compileWithDill(
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: memorySourceFiles,
|
memorySourceFiles: memorySourceFiles,
|
||||||
options: [Flags.useKernel]..addAll(options),
|
options: options,
|
||||||
diagnosticHandler: diagnosticHandler,
|
diagnosticHandler: diagnosticHandler,
|
||||||
outputProvider: compilerOutput,
|
outputProvider: compilerOutput,
|
||||||
beforeRun: (compiler) {
|
beforeRun: (compiler) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ Future<jsAst.Expression> compile(String code,
|
||||||
Flags.disableInlining,
|
Flags.disableInlining,
|
||||||
];
|
];
|
||||||
if (disableTypeInference) options.add(Flags.disableTypeInference);
|
if (disableTypeInference) options.add(Flags.disableTypeInference);
|
||||||
if (useKernel) options.add(Flags.useKernel);
|
if (!useKernel) options.add(Flags.useOldFrontend);
|
||||||
options.addAll(extraOptions);
|
options.addAll(extraOptions);
|
||||||
|
|
||||||
if (lookup is String && lookup != 'main' && !code.contains('main')) {
|
if (lookup is String && lookup != 'main' && !code.contains('main')) {
|
||||||
|
|
|
@ -115,8 +115,9 @@ main(List<String> args) {
|
||||||
|
|
||||||
print(
|
print(
|
||||||
'---- compiler from ast -----------------------------------------------');
|
'---- compiler from ast -----------------------------------------------');
|
||||||
var result =
|
var result = await runCompiler(
|
||||||
await runCompiler(entryPoint: entryPoint, options: [Flags.analyzeOnly]);
|
entryPoint: entryPoint,
|
||||||
|
options: [Flags.analyzeOnly, Flags.useOldFrontend]);
|
||||||
Compiler compiler1 = result.compiler;
|
Compiler compiler1 = result.compiler;
|
||||||
|
|
||||||
Compiler compiler2 = await compileWithDill(
|
Compiler compiler2 = await compileWithDill(
|
||||||
|
|
|
@ -102,7 +102,7 @@ Future<ResultKind> mainInternal(List<String> args,
|
||||||
await runWithD8(
|
await runWithD8(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
memorySourceFiles: memorySourceFiles,
|
memorySourceFiles: memorySourceFiles,
|
||||||
options: [Flags.useKernel, Flags.enableAssertMessage],
|
options: [Flags.enableAssertMessage],
|
||||||
expectedOutput: OUTPUT);
|
expectedOutput: OUTPUT);
|
||||||
|
|
||||||
return ResultKind.success;
|
return ResultKind.success;
|
||||||
|
|
|
@ -144,7 +144,7 @@ CompilerImpl compilerFor(
|
||||||
PackagesDiscoveryProvider packagesDiscoveryProvider}) {
|
PackagesDiscoveryProvider packagesDiscoveryProvider}) {
|
||||||
Uri libraryRoot = Uri.base.resolve('sdk/');
|
Uri libraryRoot = Uri.base.resolve('sdk/');
|
||||||
Uri platformBinaries;
|
Uri platformBinaries;
|
||||||
if (options.contains(Flags.useKernel)) {
|
if (!options.contains(Flags.useOldFrontend)) {
|
||||||
platformBinaries = computePlatformBinariesLocation();
|
platformBinaries = computePlatformBinariesLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,5 @@ DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
runCompiler(
|
runCompiler(memorySourceFiles: {'main.dart': 'main() {}'});
|
||||||
memorySourceFiles: {'main.dart': 'main() {}'},
|
|
||||||
options: [Flags.useKernel]);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
// affect optimizations done on arrays.
|
// affect optimizations done on arrays.
|
||||||
|
|
||||||
import 'package:expect/expect.dart';
|
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';
|
import '../memory_compiler.dart';
|
||||||
|
|
||||||
const MEMORY_SOURCE_FILES = const {
|
const MEMORY_SOURCE_FILES = const {
|
||||||
|
@ -32,7 +33,9 @@ main() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
asyncTest(() async {
|
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 compiler = result.compiler;
|
||||||
var element = compiler.frontendStrategy.elementEnvironment.mainFunction;
|
var element = compiler.frontendStrategy.elementEnvironment.mainFunction;
|
||||||
var code = compiler.backend.getGeneratedCode(element);
|
var code = compiler.backend.getGeneratedCode(element);
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:expect/expect.dart';
|
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';
|
import '../memory_compiler.dart';
|
||||||
|
|
||||||
Future runTest(String mainScript, test) async {
|
Future runTest(String mainScript, test) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
entryPoint: Uri.parse(mainScript),
|
entryPoint: Uri.parse(mainScript),
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES);
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
test(result.compiler);
|
test(result.compiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ library dart2js.test.import_mirrors;
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:expect/expect.dart';
|
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 'package:compiler/src/diagnostics/messages.dart'
|
import 'package:compiler/src/diagnostics/messages.dart'
|
||||||
show MessageKind, MessageTemplate;
|
show MessageKind, MessageTemplate;
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -309,7 +310,7 @@ Future test(Map sourceFiles,
|
||||||
expectedPaths = [expectedPaths];
|
expectedPaths = [expectedPaths];
|
||||||
}
|
}
|
||||||
var collector = new DiagnosticCollector();
|
var collector = new DiagnosticCollector();
|
||||||
var options = [];
|
var options = [Flags.useOldFrontend];
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
options.add('--verbose');
|
options.add('--verbose');
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import 'package:expect/expect.dart';
|
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' show runCompiler;
|
import '../memory_compiler.dart' show runCompiler;
|
||||||
import '../compiler_helper.dart' show findElement;
|
import '../compiler_helper.dart' show findElement;
|
||||||
import '../inference/type_mask_test_helper.dart';
|
import '../inference/type_mask_test_helper.dart';
|
||||||
|
@ -25,7 +26,9 @@ main() {
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
asyncTest(() async {
|
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 compiler = result.compiler;
|
||||||
var element = findElement(compiler, 'field');
|
var element = findElement(compiler, 'field');
|
||||||
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import 'package:expect/expect.dart';
|
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' show runCompiler;
|
import '../memory_compiler.dart' show runCompiler;
|
||||||
import '../compiler_helper.dart' show findElement;
|
import '../compiler_helper.dart' show findElement;
|
||||||
import '../inference/type_mask_test_helper.dart';
|
import '../inference/type_mask_test_helper.dart';
|
||||||
|
@ -25,7 +26,9 @@ main() {
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
asyncTest(() async {
|
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 compiler = result.compiler;
|
||||||
var element = findElement(compiler, 'field');
|
var element = findElement(compiler, 'field');
|
||||||
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
var typesInferrer = compiler.globalInference.typesInferrerInternal;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import 'package:expect/expect.dart';
|
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' show runCompiler;
|
import '../memory_compiler.dart' show runCompiler;
|
||||||
import '../compiler_helper.dart' show findElement;
|
import '../compiler_helper.dart' show findElement;
|
||||||
|
|
||||||
|
@ -38,7 +39,9 @@ class Super {
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
asyncTest(() async {
|
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 compiler = result.compiler;
|
||||||
|
|
||||||
dynamic superclass =
|
dynamic superclass =
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// Test that tree-shaking hasn't been turned off.
|
// Test that tree-shaking hasn't been turned off.
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.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/compiler.dart';
|
||||||
import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
|
import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
|
||||||
import 'package:compiler/src/js_backend/mirrors_analysis.dart';
|
import 'package:compiler/src/js_backend/mirrors_analysis.dart';
|
||||||
|
@ -15,7 +16,9 @@ main() {
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
JavaScriptBackend backend = compiler.backend;
|
JavaScriptBackend backend = compiler.backend;
|
||||||
Expect.isTrue(collector.errors.isEmpty);
|
Expect.isTrue(collector.errors.isEmpty);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import "package:async_helper/async_helper.dart";
|
||||||
import '../memory_compiler.dart' show runCompiler;
|
import '../memory_compiler.dart' show runCompiler;
|
||||||
|
|
||||||
import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
|
import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
|
|
||||||
import 'package:compiler/src/constants/values.dart'
|
import 'package:compiler/src/constants/values.dart'
|
||||||
show ConstantValue, TypeConstantValue;
|
show ConstantValue, TypeConstantValue;
|
||||||
|
@ -54,7 +55,7 @@ void main() {
|
||||||
var result = await runCompiler(
|
var result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
|
diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
|
||||||
options: ['--enable-experimental-mirrors']);
|
options: ['--enable-experimental-mirrors', Flags.useOldFrontend]);
|
||||||
CompilerImpl compiler = result.compiler;
|
CompilerImpl compiler = result.compiler;
|
||||||
JavaScriptBackend backend = compiler.backend;
|
JavaScriptBackend backend = compiler.backend;
|
||||||
print('');
|
print('');
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
import 'package:compiler/compiler_new.dart';
|
import 'package:compiler/compiler_new.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import '../memory_compiler.dart' show runCompiler, OutputCollector;
|
import '../memory_compiler.dart' show runCompiler, OutputCollector;
|
||||||
|
|
||||||
const MEMORY_SOURCE_FILES = const <String, String>{
|
const MEMORY_SOURCE_FILES = const <String, String>{
|
||||||
|
@ -40,7 +41,7 @@ class Super {
|
||||||
|
|
||||||
runTest(bool preserveUris) async {
|
runTest(bool preserveUris) async {
|
||||||
OutputCollector collector = new OutputCollector();
|
OutputCollector collector = new OutputCollector();
|
||||||
var options = ["--minify"];
|
var options = ["--minify", Flags.useOldFrontend];
|
||||||
if (preserveUris) options.add("--preserve-uris");
|
if (preserveUris) options.add("--preserve-uris");
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
|
|
|
@ -599,7 +599,7 @@ Future testData(TestData data) async {
|
||||||
print(
|
print(
|
||||||
'--test ast----------------------------------------------------------');
|
'--test ast----------------------------------------------------------');
|
||||||
await runTest(
|
await runTest(
|
||||||
[Flags.analyzeAll],
|
[Flags.useOldFrontend, Flags.analyzeAll],
|
||||||
(Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
|
(Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
|
||||||
compiler,
|
compiler,
|
||||||
constantRequired: field.isConst));
|
constantRequired: field.isConst));
|
||||||
|
@ -607,8 +607,7 @@ Future testData(TestData data) async {
|
||||||
if (!skipKernelList.contains(data.name)) {
|
if (!skipKernelList.contains(data.name)) {
|
||||||
print(
|
print(
|
||||||
'--test kernel-------------------------------------------------------');
|
'--test kernel-------------------------------------------------------');
|
||||||
await runTest([Flags.useKernel, Flags.analyzeOnly],
|
await runTest([Flags.analyzeOnly], (Compiler compiler, FieldEntity field) {
|
||||||
(Compiler compiler, FieldEntity field) {
|
|
||||||
KernelFrontEndStrategy frontendStrategy = compiler.frontendStrategy;
|
KernelFrontEndStrategy frontendStrategy = compiler.frontendStrategy;
|
||||||
KernelToElementMap elementMap = frontendStrategy.elementMap;
|
KernelToElementMap elementMap = frontendStrategy.elementMap;
|
||||||
return new KernelEvaluationEnvironment(elementMap, null, field,
|
return new KernelEvaluationEnvironment(elementMap, null, field,
|
||||||
|
|
|
@ -9,8 +9,8 @@ import 'package:async_helper/async_helper.dart';
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import 'package:compiler/src/constants/expressions.dart';
|
import 'package:compiler/src/constants/expressions.dart';
|
||||||
import 'package:compiler/src/compiler.dart';
|
import 'package:compiler/src/compiler.dart';
|
||||||
import 'package:compiler/src/compile_time_constants.dart';
|
import 'package:compiler/src/kernel/element_map_impl.dart';
|
||||||
import 'package:compiler/src/elements/elements.dart';
|
import 'package:compiler/src/elements/entities.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
import 'constant_expression_evaluate_test.dart' show MemoryEnvironment;
|
import 'constant_expression_evaluate_test.dart' show MemoryEnvironment;
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ const List<TestData> DATA = const [
|
||||||
const ConstantData('"foo"', ConstantExpressionKind.STRING),
|
const ConstantData('"foo"', ConstantExpressionKind.STRING),
|
||||||
const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
|
const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
|
||||||
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 ?? 2', ConstantExpressionKind.BINARY),
|
||||||
const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'),
|
const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'),
|
||||||
const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH),
|
const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH),
|
||||||
|
@ -154,34 +155,35 @@ class C<U> {
|
||||||
const ConstantData(
|
const ConstantData(
|
||||||
'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
||||||
type: 'A<int>', fields: const {'field(A#field1)': '87'}),
|
type: 'A<int>', fields: const {'field(A#field1)': '87'}),
|
||||||
const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
|
// TODO(sigmund): reenable (Issue 32511)
|
||||||
type: 'A<B<dynamic>>',
|
//const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
|
||||||
fields: const {
|
// type: 'A<B<dynamic>>',
|
||||||
'field(A#field1)': '42',
|
// fields: const {
|
||||||
}),
|
// 'field(A#field1)': '42',
|
||||||
const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
|
// }),
|
||||||
type: 'A<B<int>>',
|
//const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
|
||||||
fields: const {
|
// type: 'A<B<int>>',
|
||||||
'field(A#field1)': '42',
|
// fields: const {
|
||||||
}),
|
// 'field(A#field1)': '42',
|
||||||
const ConstantData(
|
// }),
|
||||||
'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
//const ConstantData(
|
||||||
type: 'A<B<int>>',
|
// 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
||||||
fields: const {
|
// type: 'A<B<int>>',
|
||||||
'field(A#field1)': '87',
|
// fields: const {
|
||||||
}),
|
// 'field(A#field1)': '87',
|
||||||
const ConstantData(
|
// }),
|
||||||
'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
//const ConstantData(
|
||||||
type: 'A<B<double>>',
|
// 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
|
||||||
fields: const {
|
// type: 'A<B<double>>',
|
||||||
'field(A#field1)': '87',
|
// fields: const {
|
||||||
}),
|
// 'field(A#field1)': '87',
|
||||||
const ConstantData(
|
// }),
|
||||||
'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
|
//const ConstantData(
|
||||||
type: 'A<int>',
|
// 'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
|
||||||
fields: const {
|
// type: 'A<int>',
|
||||||
'field(A#field1)': '42',
|
// fields: const {
|
||||||
}),
|
// 'field(A#field1)': '42',
|
||||||
|
// }),
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -203,12 +205,17 @@ Future testData(TestData data) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']);
|
memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
MemoryEnvironment environment =
|
var elementEnvironment = compiler.frontendStrategy.elementEnvironment;
|
||||||
new MemoryEnvironment(new AstEvaluationEnvironment(compiler));
|
|
||||||
dynamic library = compiler.frontendStrategy.elementEnvironment.mainLibrary;
|
MemoryEnvironment environment = new MemoryEnvironment(
|
||||||
|
new KernelEvaluationEnvironment(
|
||||||
|
(compiler.frontendStrategy as dynamic).elementMap,
|
||||||
|
compiler.environment,
|
||||||
|
null));
|
||||||
|
dynamic library = elementEnvironment.mainLibrary;
|
||||||
constants.forEach((String name, ConstantData data) {
|
constants.forEach((String name, ConstantData data) {
|
||||||
FieldElement field = library.localLookup(name);
|
FieldEntity field = elementEnvironment.lookupLibraryMember(library, name);
|
||||||
dynamic constant = field.constant;
|
dynamic constant = elementEnvironment.getFieldConstant(field);
|
||||||
Expect.equals(
|
Expect.equals(
|
||||||
data.kind,
|
data.kind,
|
||||||
constant.kind,
|
constant.kind,
|
||||||
|
@ -237,6 +244,8 @@ Future testData(TestData data) async {
|
||||||
"`${constant.toDartText()}`, expected '${data.fields.length}'.");
|
"`${constant.toDartText()}`, expected '${data.fields.length}'.");
|
||||||
instanceFields.forEach((field, expression) {
|
instanceFields.forEach((field, expression) {
|
||||||
String name = '$field';
|
String name = '$field';
|
||||||
|
Expect.isTrue(name.startsWith('k:'));
|
||||||
|
name = name.substring(2).replaceAll('.', "#");
|
||||||
String expression = instanceFields[field].toDartText();
|
String expression = instanceFields[field].toDartText();
|
||||||
String expected = data.fields[name];
|
String expected = data.fields[name];
|
||||||
Expect.equals(
|
Expect.equals(
|
||||||
|
|
|
@ -212,7 +212,7 @@ main() {
|
||||||
print(test.code);
|
print(test.code);
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': test.code},
|
memorySourceFiles: {'main.dart': test.code},
|
||||||
options: useKernel ? [Flags.useKernel] : []);
|
options: useKernel ? [] : [Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
checkTest(compiler, test);
|
checkTest(compiler, test);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ Future<DiagnosticCollector> run(String source,
|
||||||
{bool analyzeAll, bool expectSuccess}) async {
|
{bool analyzeAll, bool expectSuccess}) async {
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
|
|
||||||
List<String> options = [];
|
List<String> options = [Flags.useOldFrontend];
|
||||||
if (analyzeAll) {
|
if (analyzeAll) {
|
||||||
options.add(Flags.analyzeAll);
|
options.add(Flags.analyzeAll);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,6 +31,7 @@ main(List<String> arguments) {
|
||||||
bool verbose = arguments.contains('-v');
|
bool verbose = arguments.contains('-v');
|
||||||
|
|
||||||
List<String> options = <String>[
|
List<String> options = <String>[
|
||||||
|
Flags.useOldFrontend,
|
||||||
Flags.analyzeOnly,
|
Flags.analyzeOnly,
|
||||||
Flags.analyzeMain,
|
Flags.analyzeMain,
|
||||||
'--categories=Client,Server'
|
'--categories=Client,Server'
|
||||||
|
|
|
@ -232,6 +232,7 @@ Future analyze(
|
||||||
var provider = new CompilerSourceFileProvider();
|
var provider = new CompilerSourceFileProvider();
|
||||||
var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider);
|
var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider);
|
||||||
options = <String>[
|
options = <String>[
|
||||||
|
Flags.useOldFrontend,
|
||||||
Flags.analyzeOnly,
|
Flags.analyzeOnly,
|
||||||
'--categories=Client,Server',
|
'--categories=Client,Server',
|
||||||
Flags.showPackageWarnings
|
Flags.showPackageWarnings
|
||||||
|
|
|
@ -40,6 +40,7 @@ runCompiler(String main, List<String> options,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options = [Flags.useOldFrontend]..addAll(options);
|
||||||
print('-----------------------------------------------');
|
print('-----------------------------------------------');
|
||||||
print('main source:\n$main');
|
print('main source:\n$main');
|
||||||
print('options: $options\n');
|
print('options: $options\n');
|
||||||
|
|
|
@ -35,7 +35,10 @@ main() {
|
||||||
provider,
|
provider,
|
||||||
new LegacyCompilerOutput(),
|
new LegacyCompilerOutput(),
|
||||||
new LegacyCompilerDiagnostics(diagnosticHandler),
|
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((_) {
|
asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
|
||||||
Expect.isTrue(compiler.compilationFailed);
|
Expect.isTrue(compiler.compilationFailed);
|
||||||
Expect.equals(5, errorCount);
|
Expect.equals(5, errorCount);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.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/compiler.dart';
|
||||||
import 'package:compiler/src/diagnostics/messages.dart';
|
import 'package:compiler/src/diagnostics/messages.dart';
|
||||||
import 'package:compiler/src/js_backend/js_backend.dart';
|
import 'package:compiler/src/js_backend/js_backend.dart';
|
||||||
|
@ -28,7 +29,9 @@ testExamples(MessageKind kind) async {
|
||||||
}
|
}
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: example, diagnosticHandler: collector);
|
memorySourceFiles: example,
|
||||||
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Expect
|
Expect
|
||||||
.isTrue(collector.errors.any((message) => message.messageKind == kind));
|
.isTrue(collector.errors.any((message) => message.messageKind == kind));
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import "package:expect/expect.dart";
|
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";
|
import "../memory_compiler.dart";
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ runTest(String source, String categories, int expectedErrors) async {
|
||||||
var collector = new DiagnosticCollector();
|
var collector = new DiagnosticCollector();
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: {"main.dart": source},
|
memorySourceFiles: {"main.dart": source},
|
||||||
options: ["--categories=$categories"],
|
options: ["--categories=$categories", Flags.useOldFrontend],
|
||||||
diagnosticHandler: collector);
|
diagnosticHandler: collector);
|
||||||
Expect.equals(expectedErrors, collector.errors.length);
|
Expect.equals(expectedErrors, collector.errors.length);
|
||||||
Expect.equals(0, collector.warnings.length);
|
Expect.equals(0, collector.warnings.length);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
import 'package:compiler/src/apiimpl.dart';
|
import 'package:compiler/src/apiimpl.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
|
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
|
||||||
import 'package:compiler/src/resolution/class_members.dart'
|
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 String DART2JS_SOURCE = 'pkg/compiler/lib/src/dart2js.dart';
|
||||||
const List<String> DART2JS_OPTIONS = const <String>[
|
const List<String> DART2JS_OPTIONS = const <String>[
|
||||||
'--categories=Client,Server',
|
'--categories=Client,Server',
|
||||||
'--disable-type-inference'
|
'--disable-type-inference',
|
||||||
|
Flags.useOldFrontend
|
||||||
];
|
];
|
||||||
|
|
||||||
Iterable<ClassEntity> computeLiveClasses(CompilerImpl compiler) {
|
Iterable<ClassEntity> computeLiveClasses(CompilerImpl compiler) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ Future<Compiler> test(Uri entryPoint,
|
||||||
print('==================================================================');
|
print('==================================================================');
|
||||||
print('test: $entryPoint showPackageWarnings=$showPackageWarnings '
|
print('test: $entryPoint showPackageWarnings=$showPackageWarnings '
|
||||||
'suppressHints=$suppressHints');
|
'suppressHints=$suppressHints');
|
||||||
var options = [Flags.analyzeOnly];
|
var options = [Flags.analyzeOnly, Flags.useOldFrontend];
|
||||||
if (showPackageWarnings) {
|
if (showPackageWarnings) {
|
||||||
options.add(Flags.showPackageWarnings);
|
options.add(Flags.showPackageWarnings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import 'package:compiler/compiler_new.dart' show Diagnostic;
|
import 'package:compiler/compiler_new.dart' show Diagnostic;
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -13,7 +14,7 @@ void main() {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
options: ['--analyze-all']);
|
options: ['--analyze-all', Flags.useOldFrontend]);
|
||||||
|
|
||||||
List<String> diagnostics = <String>[];
|
List<String> diagnostics = <String>[];
|
||||||
collector.messages.forEach((CollectedMessage message) {
|
collector.messages.forEach((CollectedMessage message) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ Future test(Map<String, String> source,
|
||||||
memorySourceFiles: source,
|
memorySourceFiles: source,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
showDiagnostics: true,
|
showDiagnostics: true,
|
||||||
options: [Flags.analyzeOnly, Flags.analyzeAll],
|
options: [Flags.analyzeOnly, Flags.analyzeAll, Flags.useOldFrontend],
|
||||||
packageRoot: Uri.parse('memory:pkg/'));
|
packageRoot: Uri.parse('memory:pkg/'));
|
||||||
|
|
||||||
Expect.isTrue(collector.errors.isEmpty);
|
Expect.isTrue(collector.errors.isEmpty);
|
||||||
|
|
|
@ -8,6 +8,7 @@ library dart2js.test.error_token;
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import "package:compiler/src/diagnostics/messages.dart";
|
import "package:compiler/src/diagnostics/messages.dart";
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -20,7 +21,8 @@ Future runTest(String code,
|
||||||
entryPoint: Uri.parse('memory:main.dart'),
|
entryPoint: Uri.parse('memory:main.dart'),
|
||||||
memorySourceFiles: {'main.dart': code},
|
memorySourceFiles: {'main.dart': code},
|
||||||
diagnosticHandler: diagnostics,
|
diagnosticHandler: diagnostics,
|
||||||
outputProvider: output);
|
outputProvider: output,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
|
|
||||||
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
|
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
|
||||||
if (error != null)
|
if (error != null)
|
||||||
|
|
|
@ -48,7 +48,8 @@ void check(Map<String, List<String>> testFiles,
|
||||||
entryPoint: Uri.parse('memory:$testFileName'),
|
entryPoint: Uri.parse('memory:$testFileName'),
|
||||||
memorySourceFiles: {testFileName: testSources[testName]},
|
memorySourceFiles: {testFileName: testSources[testName]},
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
options: [Flags.analyzeOnly]..addAll(options),
|
options: [Flags.analyzeOnly, Flags.useOldFrontend]
|
||||||
|
..addAll(options),
|
||||||
showDiagnostics: verbose,
|
showDiagnostics: verbose,
|
||||||
cachedCompiler: cachedCompiler);
|
cachedCompiler: cachedCompiler);
|
||||||
var compiler = result.compiler;
|
var compiler = result.compiler;
|
||||||
|
|
|
@ -14,6 +14,7 @@ library dart2js.test.generic_method_type_usage;
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import "package:compiler/src/diagnostics/messages.dart";
|
import "package:compiler/src/diagnostics/messages.dart";
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -90,7 +91,7 @@ Future runTest(Uri main, {MessageKind warning, MessageKind info}) async {
|
||||||
OutputCollector output = new OutputCollector();
|
OutputCollector output = new OutputCollector();
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
entryPoint: main,
|
entryPoint: main,
|
||||||
options: const <String>["--generic-method-syntax"],
|
options: const <String>["--generic-method-syntax", Flags.useOldFrontend],
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: diagnostics,
|
diagnosticHandler: diagnostics,
|
||||||
outputProvider: output);
|
outputProvider: output);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
library dart2js.test.import;
|
library dart2js.test.import;
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import 'package:compiler/src/diagnostics/messages.dart';
|
import 'package:compiler/src/diagnostics/messages.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ testEntryPointIsPart() async {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
entryPoint: Uri.parse('memory:part.dart'),
|
entryPoint: Uri.parse('memory:part.dart'),
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: collector);
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
|
|
||||||
collector.checkMessages([const Expected.error(MessageKind.MAIN_HAS_PART_OF)]);
|
collector.checkMessages([const Expected.error(MessageKind.MAIN_HAS_PART_OF)]);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +57,8 @@ testImportPart() async {
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
entryPoint: Uri.parse('memory:lib.dart'),
|
entryPoint: Uri.parse('memory:lib.dart'),
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: collector);
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
|
|
||||||
collector.checkMessages([
|
collector.checkMessages([
|
||||||
const Expected.error(MessageKind.IMPORT_PART_OF),
|
const Expected.error(MessageKind.IMPORT_PART_OF),
|
||||||
|
@ -66,7 +69,9 @@ testImportPart() async {
|
||||||
testMissingImports() async {
|
testMissingImports() async {
|
||||||
var collector = new DiagnosticCollector();
|
var collector = new DiagnosticCollector();
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
|
|
||||||
collector.checkMessages([
|
collector.checkMessages([
|
||||||
const Expected.error(MessageKind.READ_URI_ERROR),
|
const Expected.error(MessageKind.READ_URI_ERROR),
|
||||||
|
@ -81,7 +86,8 @@ testMissingMain() async {
|
||||||
var collector = new DiagnosticCollector();
|
var collector = new DiagnosticCollector();
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
entryPoint: Uri.parse('memory:missing.dart'),
|
entryPoint: Uri.parse('memory:missing.dart'),
|
||||||
diagnosticHandler: collector);
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
collector.checkMessages([const Expected.error(MessageKind.READ_SELF_ERROR)]);
|
collector.checkMessages([const Expected.error(MessageKind.READ_SELF_ERROR)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,9 @@ class CustomCompiler extends CompilerImpl {
|
||||||
const NullCompilerOutput(),
|
const NullCompilerOutput(),
|
||||||
handler,
|
handler,
|
||||||
new CompilerOptions(
|
new CompilerOptions(
|
||||||
libraryRoot: libraryRoot, packageConfig: packageConfig));
|
libraryRoot: libraryRoot,
|
||||||
|
useKernel: false,
|
||||||
|
packageConfig: packageConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
main() async {
|
main() async {
|
||||||
|
|
|
@ -9,6 +9,7 @@ library dart2js.test.malformed_uri;
|
||||||
|
|
||||||
import 'package:expect/expect.dart';
|
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';
|
import '../memory_compiler.dart';
|
||||||
|
|
||||||
const MEMORY_SOURCE_FILES = const {
|
const MEMORY_SOURCE_FILES = const {
|
||||||
|
@ -23,7 +24,9 @@ testMalformedUri() {
|
||||||
asyncTest(() async {
|
asyncTest(() async {
|
||||||
var collector = new DiagnosticCollector();
|
var collector = new DiagnosticCollector();
|
||||||
await runCompiler(
|
await runCompiler(
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
|
diagnosticHandler: collector,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
Expect.equals(1, collector.errors.length);
|
Expect.equals(1, collector.errors.length);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ library members_test;
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import "package:async_helper/async_helper.dart";
|
import "package:async_helper/async_helper.dart";
|
||||||
import '../type_test_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/resolution_types.dart';
|
||||||
import "package:compiler/src/elements/elements.dart"
|
import "package:compiler/src/elements/elements.dart"
|
||||||
show ClassElement, MemberSignature;
|
show ClassElement, MemberSignature;
|
||||||
|
@ -187,7 +188,9 @@ void testClassMembers() {
|
||||||
class C<S> extends B<S> {}
|
class C<S> extends B<S> {}
|
||||||
class D extends C<int> {}
|
class D extends C<int> {}
|
||||||
class E extends D {}
|
class E extends D {}
|
||||||
""", compileMode: CompileMode.memory).then((env) {
|
""",
|
||||||
|
options: [Flags.useOldFrontend],
|
||||||
|
compileMode: CompileMode.memory).then((env) {
|
||||||
ResolutionInterfaceType bool_ = env['bool'];
|
ResolutionInterfaceType bool_ = env['bool'];
|
||||||
ResolutionInterfaceType String_ = env['String'];
|
ResolutionInterfaceType String_ = env['String'];
|
||||||
ResolutionInterfaceType int_ = env['int'];
|
ResolutionInterfaceType int_ = env['int'];
|
||||||
|
@ -445,7 +448,7 @@ void testInterfaceMembers() {
|
||||||
num method4();
|
num method4();
|
||||||
}
|
}
|
||||||
abstract class D implements A, B, C {}
|
abstract class D implements A, B, C {}
|
||||||
""").then((env) {
|
""", options: [Flags.useOldFrontend]).then((env) {
|
||||||
ResolutionDynamicType dynamic_ = env['dynamic'];
|
ResolutionDynamicType dynamic_ = env['dynamic'];
|
||||||
ResolutionVoidType void_ = env['void'];
|
ResolutionVoidType void_ = env['void'];
|
||||||
ResolutionInterfaceType num_ = env['num'];
|
ResolutionInterfaceType num_ = env['num'];
|
||||||
|
@ -614,7 +617,7 @@ void testClassVsInterfaceMembers() {
|
||||||
method2(a);
|
method2(a);
|
||||||
}
|
}
|
||||||
abstract class C extends A implements B {}
|
abstract class C extends A implements B {}
|
||||||
""").then((env) {
|
""", options: [Flags.useOldFrontend]).then((env) {
|
||||||
ResolutionDynamicType dynamic_ = env['dynamic'];
|
ResolutionDynamicType dynamic_ = env['dynamic'];
|
||||||
|
|
||||||
ResolutionInterfaceType A = env['A'];
|
ResolutionInterfaceType A = env['A'];
|
||||||
|
@ -665,7 +668,7 @@ void testMixinMembers() {
|
||||||
method3(S a) {}
|
method3(S a) {}
|
||||||
}
|
}
|
||||||
abstract class C<U, V> extends Object with A<U> implements B<V> {}
|
abstract class C<U, V> extends Object with A<U> implements B<V> {}
|
||||||
""").then((env) {
|
""", options: [Flags.useOldFrontend]).then((env) {
|
||||||
ResolutionDynamicType dynamic_ = env['dynamic'];
|
ResolutionDynamicType dynamic_ = env['dynamic'];
|
||||||
|
|
||||||
ClassElement A = env.getElement('A');
|
ClassElement A = env.getElement('A');
|
||||||
|
@ -734,7 +737,7 @@ void testMixinMembersWithoutImplements() {
|
||||||
abstract class B implements A {
|
abstract class B implements A {
|
||||||
}
|
}
|
||||||
abstract class C extends Object with B {}
|
abstract class C extends Object with B {}
|
||||||
""").then((env) {
|
""", options: [Flags.useOldFrontend]).then((env) {
|
||||||
ResolutionDynamicType dynamic_ = env['dynamic'];
|
ResolutionDynamicType dynamic_ = env['dynamic'];
|
||||||
|
|
||||||
ResolutionInterfaceType A = env['A'];
|
ResolutionInterfaceType A = env['A'];
|
||||||
|
|
|
@ -69,8 +69,11 @@ Future<Compiler> check(MessageTemplate template, Compiler cachedCompiler) {
|
||||||
Compiler compiler = compilerFor(
|
Compiler compiler = compilerFor(
|
||||||
memorySourceFiles: example,
|
memorySourceFiles: example,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
options: [Flags.analyzeOnly, Flags.enableExperimentalMirrors]
|
options: [
|
||||||
..addAll(template.options),
|
Flags.analyzeOnly,
|
||||||
|
Flags.enableExperimentalMirrors,
|
||||||
|
Flags.useOldFrontend
|
||||||
|
]..addAll(template.options),
|
||||||
cachedCompiler: cachedCompiler);
|
cachedCompiler: cachedCompiler);
|
||||||
|
|
||||||
return compiler.run(Uri.parse('memory:main.dart')).then((_) {
|
return compiler.run(Uri.parse('memory:main.dart')).then((_) {
|
||||||
|
|
|
@ -146,7 +146,7 @@ main() {
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': test.code},
|
memorySourceFiles: {'main.dart': test.code},
|
||||||
options: [Flags.analyzeOnly],
|
options: [Flags.analyzeOnly, Flags.useOldFrontend],
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
cachedCompiler: cachedCompiler);
|
cachedCompiler: cachedCompiler);
|
||||||
cachedCompiler = result.compiler;
|
cachedCompiler = result.compiler;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import 'package:compiler/src/diagnostics/messages.dart';
|
import 'package:compiler/src/diagnostics/messages.dart';
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -10,7 +11,9 @@ runTest(String code,
|
||||||
print(code);
|
print(code);
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
await runCompiler(
|
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.equals(0, collector.errors.length, "Unexpected errors.");
|
||||||
Expect.listEquals(
|
Expect.listEquals(
|
||||||
expectedWarnings,
|
expectedWarnings,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// Test that elements are not needlessly required by dart2js.
|
// Test that elements are not needlessly required by dart2js.
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.dart';
|
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/common/names.dart';
|
||||||
import 'package:compiler/src/compiler.dart';
|
import 'package:compiler/src/compiler.dart';
|
||||||
import 'package:compiler/src/elements/elements.dart';
|
import 'package:compiler/src/elements/elements.dart';
|
||||||
|
@ -36,7 +37,8 @@ void checkInstantiated(Compiler compiler, ClassElement cls, bool expected) {
|
||||||
analyze(String code,
|
analyze(String code,
|
||||||
{bool proxyConstantComputed: false, bool deprecatedClass: false}) async {
|
{bool proxyConstantComputed: false, bool deprecatedClass: false}) async {
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': code}, options: ['--analyze-only']);
|
memorySourceFiles: {'main.dart': code},
|
||||||
|
options: ['--analyze-only', Flags.useOldFrontend]);
|
||||||
Expect.isTrue(result.isSuccess);
|
Expect.isTrue(result.isSuccess);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
Expect.equals(
|
Expect.equals(
|
||||||
|
|
|
@ -8,6 +8,7 @@ library dart2js.test.missing_file;
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import "package:compiler/src/diagnostics/messages.dart";
|
import "package:compiler/src/diagnostics/messages.dart";
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
import '../memory_compiler.dart';
|
import '../memory_compiler.dart';
|
||||||
|
@ -36,7 +37,8 @@ Future runTest(Uri main, {MessageKind error, MessageKind info}) async {
|
||||||
entryPoint: main,
|
entryPoint: main,
|
||||||
memorySourceFiles: MEMORY_SOURCE_FILES,
|
memorySourceFiles: MEMORY_SOURCE_FILES,
|
||||||
diagnosticHandler: diagnostics,
|
diagnosticHandler: diagnostics,
|
||||||
outputProvider: output);
|
outputProvider: output,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
|
|
||||||
Expect.isFalse(output.hasExtraOutput);
|
Expect.isFalse(output.hasExtraOutput);
|
||||||
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
|
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
|
||||||
|
|
|
@ -93,6 +93,7 @@ class MockCompiler extends Compiler {
|
||||||
options: new CompilerOptions(
|
options: new CompilerOptions(
|
||||||
entryPoint: new Uri(scheme: 'mock'),
|
entryPoint: new Uri(scheme: 'mock'),
|
||||||
libraryRoot: Uri.parse('placeholder_library_root_for_mock/'),
|
libraryRoot: Uri.parse('placeholder_library_root_for_mock/'),
|
||||||
|
useKernel: false,
|
||||||
enableTypeAssertions: enableTypeAssertions,
|
enableTypeAssertions: enableTypeAssertions,
|
||||||
enableUserAssertions: enableUserAssertions,
|
enableUserAssertions: enableUserAssertions,
|
||||||
disableInlining: disableInlining,
|
disableInlining: disableInlining,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:async_helper/async_helper.dart';
|
import 'package:async_helper/async_helper.dart';
|
||||||
import 'package:expect/expect.dart';
|
import 'package:expect/expect.dart';
|
||||||
|
import 'package:compiler/src/commandline_options.dart';
|
||||||
import 'package:compiler/compiler.dart' show PackagesDiscoveryProvider;
|
import 'package:compiler/compiler.dart' show PackagesDiscoveryProvider;
|
||||||
import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
|
import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
|
||||||
import 'package:package_config/packages.dart';
|
import 'package:package_config/packages.dart';
|
||||||
|
@ -41,7 +42,8 @@ Future runTest(Uri main, MessageKind expectedMessageKind,
|
||||||
diagnosticHandler: collector,
|
diagnosticHandler: collector,
|
||||||
packageRoot: packageRoot,
|
packageRoot: packageRoot,
|
||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
packagesDiscoveryProvider: packagesDiscoveryProvider);
|
packagesDiscoveryProvider: packagesDiscoveryProvider,
|
||||||
|
options: [Flags.useOldFrontend]);
|
||||||
Expect.equals(
|
Expect.equals(
|
||||||
1, collector.errors.length, "Unexpected errors: ${collector.errors}");
|
1, collector.errors.length, "Unexpected errors: ${collector.errors}");
|
||||||
Expect.equals(expectedMessageKind, collector.errors.first.message.kind,
|
Expect.equals(expectedMessageKind, collector.errors.first.message.kind,
|
||||||
|
|
|
@ -25,7 +25,11 @@ main(List<String> arguments) async {
|
||||||
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last));
|
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last));
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
entryPoint: entryPoint,
|
entryPoint: entryPoint,
|
||||||
options: [Flags.analyzeOnly, '--categories=Client,Server']);
|
options: [
|
||||||
|
Flags.analyzeOnly,
|
||||||
|
'--categories=Client,Server',
|
||||||
|
Flags.useOldFrontend
|
||||||
|
]);
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
checkRelatedTypes(result.compiler);
|
checkRelatedTypes(result.compiler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ main(List<String> arguments) {
|
||||||
DiagnosticCollector collector = new DiagnosticCollector();
|
DiagnosticCollector collector = new DiagnosticCollector();
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: {'main.dart': CODE},
|
memorySourceFiles: {'main.dart': CODE},
|
||||||
options: [Flags.analyzeOnly, Flags.analyzeMain],
|
options: [Flags.analyzeOnly, Flags.analyzeMain, Flags.useOldFrontend],
|
||||||
diagnosticHandler: collector);
|
diagnosticHandler: collector);
|
||||||
Expect.isFalse(
|
Expect.isFalse(
|
||||||
collector.hasRegularMessages, "Unexpected analysis messages.");
|
collector.hasRegularMessages, "Unexpected analysis messages.");
|
||||||
|
|
|
@ -295,7 +295,7 @@ Future test(
|
||||||
|
|
||||||
CompilationResult result = await runCompiler(
|
CompilationResult result = await runCompiler(
|
||||||
memorySourceFiles: sourceFiles,
|
memorySourceFiles: sourceFiles,
|
||||||
options: [Flags.analyzeAll, Flags.analyzeOnly]);
|
options: [Flags.analyzeAll, Flags.analyzeOnly, Flags.useOldFrontend]);
|
||||||
Compiler compiler = result.compiler;
|
Compiler compiler = result.compiler;
|
||||||
testMap.forEach((String filename, Test test) {
|
testMap.forEach((String filename, Test test) {
|
||||||
LibraryElement library =
|
LibraryElement library =
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue