Remove unneeded kernel tests and sourcemap old-frontend tests
Change-Id: Iaf9533a812df5c872f223bce17ec7127f0b46318
Reviewed-on: https://dart-review.googlesource.com/54200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/tests/compiler/dart2js/kernel/arguments.dart b/tests/compiler/dart2js/kernel/arguments.dart
deleted file mode 100644
index 11374c0..0000000
--- a/tests/compiler/dart2js/kernel/arguments.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.kernel.arguments;
-
-import 'package:compiler/src/filenames.dart';
-
-class Arguments {
- final String filename;
- final int start;
- final int end;
- final bool verbose;
-
- const Arguments({this.filename, this.start, this.end, this.verbose: false});
-
- factory Arguments.from(List<String> arguments) {
- String filename;
- int start;
- int end;
- for (String arg in arguments) {
- if (!arg.startsWith('-')) {
- int index = int.parse(arg, onError: (_) => null);
- if (index == null) {
- filename = arg;
- } else if (start == null) {
- start = index;
- } else {
- end = index;
- }
- }
- }
- bool verbose = arguments.contains('-v');
- return new Arguments(
- filename: filename, start: start, end: end, verbose: verbose);
- }
-
- Uri get uri {
- if (filename != null) {
- return Uri.base.resolve(nativeToUriPath(filename));
- }
- return null;
- }
-}
diff --git a/tests/compiler/dart2js/kernel/assert_test.dart b/tests/compiler/dart2js/kernel/assert_test.dart
deleted file mode 100644
index 700bf42..0000000
--- a/tests/compiler/dart2js/kernel/assert_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:compiler/src/commandline_options.dart' show Flags;
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('assert without message', () {
- String code = '''
-bool foo() => 2 + 2 == 4;
-main() {
- assert(foo());
-}''';
- return check(code, extraOptions: const <String>[Flags.enableCheckedMode]);
- });
-
- test('assert with message', () {
- String code = '''
-bool foo() => 2 + 2 == 4;
-main() {
- assert(foo(), "foo failed");
-}''';
- return check(code, extraOptions: const <String>[
- Flags.enableCheckedMode,
- Flags.enableAssertMessage,
- ]);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/binary_operators_test.dart b/tests/compiler/dart2js/kernel/binary_operators_test.dart
deleted file mode 100644
index 96f3fdb..0000000
--- a/tests/compiler/dart2js/kernel/binary_operators_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile binary operators', () {
- test('plus on ints', () {
- return check('main() { return 1 + 2; }');
- });
- test('plus on strings', () {
- return check('main() { return "a" + "b"; }');
- });
- test('plus on non-constants', () {
- String code = '''
- foo() => 1;
- main() => foo() + foo();''';
- return check(code);
- });
- test('other arithmetic operators', () {
- return check('main() { return 1 + 2 * 3 - 4 / 5 % 6; }');
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world2_test.dart b/tests/compiler/dart2js/kernel/closed_world2_test.dart
deleted file mode 100644
index d21a95d..0000000
--- a/tests/compiler/dart2js/kernel/closed_world2_test.dart
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Partial test that the closed world computed from [WorldImpact]s derived from
-// kernel is equivalent to the original computed from resolution.
-library dart2js.kernel.closed_world2_test;
-
-import 'dart:async';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/enqueue.dart';
-import 'package:compiler/src/js_backend/backend_usage.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/util/util.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import '../equivalence/equivalence_helper.dart';
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-import 'dart:html';
-import 'dart:typed_data';
-import 'package:expect/expect.dart';
-
-class ClassWithSetter {
- void set setter(_) {}
-}
-
-class Mixin {
- method1() {}
- method2() {}
- method3() {}
-}
-class Class1 = Object with Mixin;
-class Class2 extends Object with Mixin {
- method3() {}
-}
-
-method1() {} // Deliberately the same name as the instance member in Mixin.
-
-class ClassWithCallBase {
- void call() {}
-}
-
-class ClassWithCallRequired {
- void call(int i) {}
-}
-
-class ClassWithCallGeneric<T> {
- void call(T t) {}
-}
-
-class ClassWithCallOptional<T> {
- void call([T t]) {}
-}
-
-class ClassWithCallNamed<T> {
- void call({T t}) {}
-}
-
-class ClassWithCallGetter {
- int get call => 0;
-}
-
-class ClassWithCallSetter {
- void set call(int i) {}
-}
-
-// Inherits the call type:
-class ClassWithCall1 extends ClassWithCallBase {}
-class ClassWithCall2 extends ClassWithCallRequired {}
-class ClassWithCall3 extends ClassWithCallGeneric<String> {}
-class ClassWithCall4 extends ClassWithCallOptional<String> {}
-class ClassWithCall5 extends ClassWithCallNamed<String> {}
-
-// Inherits the same call type twice:
-class ClassWithCall6 extends ClassWithCallRequired
- implements ClassWithCallGeneric<int> {}
-
-// Inherits different but compatible call types:
-class ClassWithCall7 extends ClassWithCallRequired
- implements ClassWithCallGeneric<String> {}
-class ClassWithCall8 extends ClassWithCallRequired
- implements ClassWithCallOptional<int> {}
-class ClassWithCall9 extends ClassWithCallRequired
- implements ClassWithCallOptional<String> {}
-class ClassWithCall10 extends ClassWithCallBase
- implements ClassWithCallNamed<String> {}
-
-// Inherits incompatible call types:
-class ClassWithCall11 extends ClassWithCallNamed<int>
- implements ClassWithCallOptional<int> {}
-class ClassWithCall12 extends ClassWithCallGetter {}
-class ClassWithCall13 extends ClassWithCallSetter {}
-class ClassWithCall14 extends ClassWithCallBase
- implements ClassWithCallGetter {}
-class ClassWithCall15 extends ClassWithCallBase
- implements ClassWithCallSetter {}
-
-class ClassImplementsFunction implements Function {}
-
-abstract class A {
- // redirecting factory in abstract class to other class
- factory A.a() = D.a;
- // redirecting factory in abstract class to factory in abstract class
- factory A.b() = B.a;
-}
-abstract class B implements A {
- factory B.a() => null;
-}
-class C implements B {
- // redirecting factory in concrete to other class
- factory C.a() = D.a;
-}
-class D implements C {
- D.a();
-}
-
-@NoInline()
-main() {
- print('Hello World');
- ''.contains; // Trigger member closurization.
- new Element.div();
- new ClassWithSetter().setter = null;
- new Class1().method1();
- new Class2().method2();
- new Class2().method3();
- null is List<int>; // Use generic test
- method1(); // Both top level and instance method named 'method1' are live.
- #main; // Use a const symbol.
- const Symbol('foo'); // Use the const Symbol constructor directly
- new Int8List(0); // Use redirect factory to abstract native class
-
- new ClassWithCall1();
- new ClassWithCall2();
- new ClassWithCall3();
- new ClassWithCall4();
- new ClassWithCall5();
- new ClassWithCall6();
- new ClassWithCall7();
- new ClassWithCall8();
- new ClassWithCall9();
- new ClassWithCall10();
- new ClassWithCall11();
- new ClassWithCall12();
- new ClassWithCall13();
- new ClassWithCall14();
- new ClassWithCall15();
- new ClassImplementsFunction();
-
- new A.a();
- new A.b();
- new C.a();
-}
-'''
-};
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- enableDebugMode();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
-
- print('---- analyze-only ------------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- diagnosticHandler: collector,
- options: [
- Flags.useOldFrontend,
- Flags.analyzeOnly,
- Flags.enableAssertMessage
- ],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
- BackendUsage backendUsage1 = closedWorld1.backendUsage;
-
- Pair<Compiler, Compiler> compilers =
- await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true);
- Compiler compiler = compilers.a;
- compiler.resolutionWorldBuilder.closeWorld();
- ElementEnvironment environment1 =
- compiler.frontendStrategy.elementEnvironment;
-
- Compiler compiler2 = compilers.b;
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMapForImpact elementMap = frontendStrategy.elementMap;
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence = new KernelEquivalence(elementMap);
- TestStrategy strategy = equivalence.defaultStrategy;
-
- ElementEnvironment environment2 =
- compiler2.frontendStrategy.elementEnvironment;
- checkElementEnvironment(
- environment1,
- environment2,
- compiler1.frontendStrategy.dartTypes,
- compiler2.frontendStrategy.dartTypes,
- strategy);
-
- ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
- BackendUsage backendUsage2 = closedWorld2.backendUsage;
-
- checkNativeClasses(compiler1, compiler2, strategy);
-
- checkBackendUsage(backendUsage1, backendUsage2, strategy);
-
- checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2,
- elementEquivalence: (a, b) => equivalence.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- // TODO(johnniwinther): Support class usage testing in presence of
- // redirecting constructors.
- skipClassUsageTesting: ['C'],
- verbose: arguments.verbose);
-
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart b/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
deleted file mode 100644
index 21dd30e..0000000
--- a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Partial test that the closed world computed from [WorldImpact]s derived from
-// kernel is equivalent to the original computed from resolution.
-library dart2js.kernel.closed_world_from_dill_test;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/enqueue.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-import 'dart:html';
-import 'dart:typed_data';
-import 'package:expect/expect.dart';
-
-class ClassWithSetter {
- void set setter(_) {}
-}
-
-class Mixin {
- method1() {}
- method2() {}
- method3() {}
- method4() {}
- var field;
- get property => 0;
- set property(_) {}
-}
-class Class1 = Object with Mixin;
-class Class2 extends Object with Mixin {
- method3() {}
- method5() {
- super.method4();
- super.property;
- super.property = null;
- super.field;
- super.field = null;
- }
-}
-
-method1() {} // Deliberately the same name as the instance member in Mixin.
-
-@NoInline()
-main() {
- print('Hello World');
- ''.contains; // Trigger member closurization.
- new ClassWithSetter().setter = null;
- new Class1().method1();
- new Class2().method2();
- new Class2().method3();
- new Class2().method5();
- new Element.div();
- null is List<int>; // Use generic test
- method1(); // Both top level and instance method named 'method1' are live.
- #main; // Use a const symbol.
- const Symbol('foo'); // Use the const Symbol constructor directly
- new Int8List(0); // Use redirect factory to abstract native class
-}
-'''
-};
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- enableDebugMode();
-
- Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
- print('--- create temp directory $dir -------------------------------');
- memorySourceFiles.forEach((String name, String source) {
- new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
- });
- entryPoint = dir.uri.resolve(entryPoint.path);
-
- print('---- analyze-only ------------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- diagnosticHandler: collector,
- options: [
- Flags.useOldFrontend,
- Flags.analyzeOnly,
- Flags.enableAssertMessage
- ],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
-
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage],
- printSteps: true);
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMap elementMap = frontendStrategy.elementMap;
-
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence = new KernelEquivalence(elementMap);
-
- ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
-
- checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage,
- equivalence.defaultStrategy);
-
- checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage,
- enqueuer1, enqueuer2,
- elementEquivalence: (a, b) => equivalence.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: arguments.verbose);
-
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world_tester.dart b/tests/compiler/dart2js/kernel/closed_world_tester.dart
deleted file mode 100644
index e1710af..0000000
--- a/tests/compiler/dart2js/kernel/closed_world_tester.dart
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Helper application to run `closed_world2_test` on multiple files or
-/// directories.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:args/args.dart';
-import 'package:compiler/src/filenames.dart';
-import 'closed_world2_test.dart';
-
-const String ERROR_MARKER = '---';
-
-main(List<String> args) async {
- ArgParser parser = new ArgParser();
- parser.addOption('log');
-
- ArgResults argsResults = parser.parse(args);
- String logName = argsResults['log'];
- IOSink log;
- Map<String, Result> results;
- if (logName != null) {
- if (FileSystemEntity.isFileSync(logName)) {
- // Log a previous log file if it exists and use it to only test files that
- // previously failed.
- results = readLogResults(logName);
- }
- log = new File(logName).openWrite();
- }
-
- if (results != null) {
- for (String fileName in results.keys) {
- Result result = results[fileName];
- if (result.kind == ResultKind.failure) {
- if (FileSystemEntity.isFileSync(fileName)) {
- await testFile(new File(fileName), log);
- } else {
- print("$fileName doesn't exist");
- }
- } else {
- log?.writeln('${fileName}: ${result.kind}');
- }
- }
- }
-
- for (String arg in argsResults.rest) {
- String path = nativeToUriPath(arg);
- if (FileSystemEntity.isDirectorySync(path)) {
- Directory dir = new Directory(path);
- for (FileSystemEntity file in dir.listSync(recursive: true)) {
- if (file is File && file.path.endsWith('.dart')) {
- if (results == null || !results.containsKey(file.path)) {
- await testFile(file, log);
- }
- }
- }
- } else if (FileSystemEntity.isFileSync(path)) {
- if (results == null || !results.containsKey(path)) {
- await testFile(new File(path), log);
- }
- } else {
- print("$arg doesn't exist");
- }
- }
-
- await log?.close();
-}
-
-/// Read the log file in [logName] and returns the map from test file name to
-/// [Result] stored in the log file.
-Map<String, Result> readLogResults(String logName) {
- Map<String, Result> results = <String, Result>{};
- String text = new File(logName).readAsStringSync();
- // Make a backup of the log file.
- new File('$logName~').writeAsStringSync(text);
- List<String> lines = text.split('\n');
- int index = 0;
- while (index < lines.length) {
- String line = lines[index];
- int colonPos = line.lastIndexOf(':');
- if (colonPos == -1) {
- if (!line.isEmpty) {
- print('Invalid log line @ $index: $line');
- }
- } else {
- String fileName = line.substring(0, colonPos);
- String kindName = line.substring(colonPos + 1).trim();
- ResultKind kind =
- ResultKind.values.firstWhere((kind) => '$kind' == kindName);
- String error;
- if (kind == ResultKind.failure) {
- assert(lines[index + 1] == ERROR_MARKER);
- index += 2;
- StringBuffer sb = new StringBuffer();
- while (lines[index] != ERROR_MARKER) {
- sb.writeln(lines[index]);
- index++;
- }
- error = sb.toString();
- }
- results[fileName] = new Result(kind, error);
- }
- index++;
- }
- return results;
-}
-
-Future testFile(File file, IOSink log) async {
- print('====================================================================');
- print('testing ${file.path}');
- ResultKind kind;
- String error;
- try {
- kind =
- await mainInternal([file.path], skipWarnings: true, skipErrors: true);
- } catch (e, s) {
- kind = ResultKind.failure;
- error = '$e:\n$s';
- print(error);
- }
- log?.writeln('${file.path}: ${kind}');
- if (error != null) {
- log?.writeln(ERROR_MARKER);
- log?.writeln(error);
- log?.writeln(ERROR_MARKER);
- }
- await log.flush();
-}
-
-class Result {
- final ResultKind kind;
- final String error;
-
- Result(this.kind, [this.error]);
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart b/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart
deleted file mode 100644
index 5ca5fa0..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test compilation equivalence between source and .dill based
-// compilation using the fast_startup emitter.
-library dart2js.kernel.compile_from_dill_fast_startup_test;
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-
-import 'compile_from_dill_test_helper.dart';
-
-main(List<String> args) {
- asyncTest(() async {
- await runTests(args, options: [Flags.fastStartup]);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test.dart
deleted file mode 100644
index ac7886c..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test compilation equivalence between source and .dill based
-// compilation using the default emitter (full_emitter).
-library dart2js.kernel.compile_from_dill_test;
-
-import 'package:async_helper/async_helper.dart';
-
-import 'compile_from_dill_test_helper.dart';
-
-main(List<String> args) {
- asyncTest(() async {
- await runTests(args);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
deleted file mode 100644
index 0de692d..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
+++ /dev/null
@@ -1,543 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Helper to test compilation equivalence between source and .dill based
-// compilation.
-library dart2js.kernel.compile_from_dill_test_helper;
-
-import 'dart:async';
-
-import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import '../equivalence/check_helpers.dart';
-import '../equivalence/equivalence_helper.dart';
-
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-class Test {
- final Uri uri;
- final Map<String, String> sources;
- final bool expectIdenticalOutput;
-
- const Test(this.sources, {this.expectIdenticalOutput: true}) : uri = null;
-
- Test.fromUri(this.uri, {this.expectIdenticalOutput: true})
- : sources = const {};
-
- Uri get entryPoint => uri ?? Uri.parse('memory:main.dart');
-
- String toString() => uri != null ? '$uri' : sources.values.first;
-}
-
-const List<Test> TESTS = const <Test>[
- const Test(const {
- 'main.dart': '''
-import 'dart:html';
-import 'package:expect/expect.dart';
-
-foo({named}) => 1;
-bar(a) => !a;
-class Class {
- var field;
- static var staticField;
-
- Class();
- Class.named(this.field) {
- staticField = 42;
- }
-
- method() {}
-}
-
-class SubClass extends Class {
- method() {
- super.method();
- }
-}
-
-class Generic<T> {
- method(o) => o is T;
-}
-
-var toplevel;
-
-typedef Typedef();
-
-class Mixin1 {
- var field1;
-}
-
-class Mixin2 {
- var field2;
-}
-
-class MixinSub1 extends Object with Mixin1 {
-}
-
-class MixinSub2 extends Object with Mixin1, Mixin2 {
-}
-
-main() {
- foo();
- bar(true);
- [];
- <int>[];
- {};
- new Object();
- new Class.named('');
- new SubClass().method();
- Class.staticField;
- var x = null;
- var y1 = x == null;
- var y2 = null == x;
- var z1 = x?.toString();
- var z2 = x ?? y1;
- var z3 = x ??= y2;
- var w = x == null ? null : x.toString();
- for (int i = 0; i < 10; i++) {
- if (i == 5) continue;
- x = i;
- if (i == 5) break;
- }
- int i = 0;
- while (i < 10) {
- if (i == 5) continue;
- x = i;
- if (i == 7) break;
- i++;
- }
- for (var v in [3, 5]) {
- if (v == 5) continue;
- x = v;
- if (v == 7) break;
- }
- do {
- x = i;
- if (i == 7) break;
- i++;
- } while (i < 10);
- switch (x) {
- case 0:
- x = 7;
- break;
- case 1:
- x = 9;
- break;
- default:
- x = 11;
- break;
- }
- x = toplevel;
- x = testIs(x);
- x = new Generic<int>().method(x);
- x = testAsGeneric(x);
- x = testAsFunction(x);
- print(x);
- var f = (x) {
- return 400 + x;
- };
- x = f(x);
- x = Object;
- x = Typedef;
- new MixinSub2();
- new MixinSub1();
- return x;
-}
-typedef NoArg();
-@NoInline()
-testIs(o) => o is Generic<int> || o is NoArg;
-@NoInline()
-testAsGeneric(o) => o as Generic<int>;
-@NoInline()
-testAsFunction(o) => o as NoArg;
-'''
- }),
- const Test(const {
- 'main.dart': '''
-
-main() {
- var x;
- int i = 0;
- do {
- if (i == 5) continue;
- x = i;
- if (i == 7) break;
- i++;
- } while (i < 10);
- outer1: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a == b) break outer1;
- }
- }
- outer2: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a != b) continue outer2;
- }
- }
- outer3: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a == b) break outer3;
- if (a != b) continue outer3;
- }
- }
- print(x);
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- var x = 42;
- int i = 0;
- switch (i) {
- case 0:
- print(x);
- continue label1;
- label1:
- case 1:
- print(x);
- break;
- }
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- case 5:
- print('beetle');
- break;
- world:
- case 6:
- print('cricket');
- break;
- default:
- print('bat');
- }
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- default:
- print('bat');
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 8;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-class A<U,V> {
- var a = U;
- var b = V;
-}
-class B<Q, R> extends A<R, W<Q>> {
-}
-class C<Y> extends B<Y, W<Y>> {
-}
-class W<Z> {}
-main() {
- print(new C<String>().a);
-}
-'''
- }, expectIdenticalOutput: true),
- const Test(const {
- 'main.dart': '''
-class _Marker { const _Marker(); }
-const _MARKER = const _Marker();
-class Thing<X> {
- Thing([length = _MARKER]);
-}
-foo(x) {
- print(new List(x).length);
-}
-main() {
- print(new Thing<String>(100));
-
- print(new List());
- print(new List(4));
- foo(3);
- foo(4);
-}
-'''
- }, expectIdenticalOutput: true),
-];
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-const List<String> commonOptions = const <String>[
- Flags.disableTypeInference,
- Flags.disableInlining,
- Flags.enableAssertMessage
-];
-
-Future runTests(List<String> args,
- {bool skipWarnings: false,
- bool skipErrors: false,
- List<String> options: const <String>[]}) async {
- Arguments arguments = new Arguments.from(args);
- List<Test> tests = TESTS;
- if (arguments.start != null) {
- int start = arguments.start;
- int end = arguments.end ?? 0; // Default 'end' to single test.
- if (end > tests.length) end = tests.length; // Large 'end' means all.
- if (end <= start) end = start + 1; // Always at least one test (else Error).
- tests = tests.sublist(start, end);
- } else if (arguments.uri != null) {
- tests = <Test>[new Test.fromUri(arguments.uri)];
- }
- for (Test test in tests) {
- if (test.uri != null) {
- print('--- running test uri ${test.uri} -------------------------------');
- } else {
- print(
- '--- running test code -------------------------------------------');
- print(test.sources.values.first);
- print('----------------------------------------------------------------');
- }
- await runTest(test.entryPoint, test.sources,
- verbose: arguments.verbose,
- skipWarnings: skipWarnings,
- skipErrors: skipErrors,
- options: options,
- expectIdenticalOutput: test.expectIdenticalOutput);
- }
-}
-
-Future<ResultKind> runTest(
- Uri entryPoint, Map<String, String> memorySourceFiles,
- {bool skipWarnings: false,
- bool skipErrors: false,
- bool verbose: false,
- List<String> options: const <String>[],
- bool expectAstEquivalence: false,
- bool expectIdenticalOutput: true}) async {
- enableDebugMode();
- Elements.useCFEOrder = true;
-
- print('---- compile from ast ----------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- OutputCollector collector1 = new OutputCollector();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- diagnosticHandler: collector,
- outputProvider: collector1,
- options: <String>[]..addAll(commonOptions)..addAll(options),
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ClosedWorld closedWorld1 =
- compiler1.resolutionWorldBuilder.closedWorldForTesting;
-
- OutputCollector collector2 = new OutputCollector();
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: <String>[]..addAll(commonOptions)..addAll(options),
- printSteps: true,
- compilerOutput: collector2);
-
- // Print the middle section of the outputs if they are not line-wise
- // identical.
- collector1.outputMap
- .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) {
- if (outputType == OutputType.sourceMap) {
- return;
- }
- Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType];
- checkSets(map1.keys, map2.keys, 'output', equality);
- map1.forEach((String name, BufferedOutputSink output1) {
- BufferedOutputSink output2 = map2[name];
- if (output1.text == output2.text) return;
- List<String> lines1 = output1.text.split('\n');
- List<String> lines2 = output2.text.split('\n');
- int prefix = 0;
- while (prefix < lines1.length && prefix < lines2.length) {
- if (lines1[prefix] != lines2[prefix]) {
- break;
- }
- prefix++;
- }
- if (prefix > 0) prefix--;
- int suffix1 = lines1.length - 1;
- int suffix2 = lines2.length - 1;
- while (suffix1 >= 0 && suffix2 >= 0) {
- if (lines1[suffix1] != lines2[suffix2]) {
- break;
- }
- suffix1--;
- suffix2--;
- }
- if (suffix1 + 1 < lines1.length) suffix1++;
- if (suffix2 + 1 < lines2.length) suffix2++;
- print('--- from source, lines [${prefix}-${suffix1}] ------------------');
- lines1.sublist(prefix, suffix1 + 1).forEach(print);
- print('--- from dill, lines [${prefix}-${suffix2}] --------------------');
- lines2.sublist(prefix, suffix2 + 1).forEach(print);
- });
- });
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMap elementMap = frontendStrategy.elementMap;
-
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence1 = new KernelEquivalence(elementMap);
-
- ClosedWorld closedWorld2 =
- compiler2.resolutionWorldBuilder.closedWorldForTesting;
-
- checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage,
- equivalence1.defaultStrategy);
-
- print('--- checking resolution enqueuers ----------------------------------');
- checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage,
- compiler1.enqueuer.resolution, compiler2.enqueuer.resolution,
- elementEquivalence: (a, b) => equivalence1.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence1.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: verbose);
-
- print('--- checking closed worlds -----------------------------------------');
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence1.defaultStrategy,
- verbose: verbose,
- // TODO(johnniwinther,efortuna): Require closure class equivalence when
- // these are supported.
- allowMissingClosureClasses: true);
-
- // TODO(johnniwinther): Perform equivalence tests on the model: codegen world
- // impacts, program model, etc.
-
- print('--- checking codegen enqueuers--------------------------------------');
-
- KernelBackendStrategy backendStrategy = compiler2.backendStrategy;
- KernelEquivalence equivalence2 =
- new KernelEquivalence(backendStrategy.elementMap);
-
- checkCodegenEnqueuers(compiler1.enqueuer.codegenEnqueuerForTesting,
- compiler2.enqueuer.codegenEnqueuerForTesting,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence2.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: verbose);
-
- checkEmitters(compiler1.backend.emitter, compiler2.backend.emitter,
- equivalence2.defaultStrategy,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence2.typeEquivalence(unalias(a), b);
- },
- verbose: verbose);
-
- if (expectAstEquivalence) {
- checkGeneratedCode(compiler1.backend, compiler2.backend,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b));
- }
-
- if (expectIdenticalOutput) {
- print('--- checking output------- ---------------------------------------');
- collector1.outputMap
- .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) {
- if (outputType == OutputType.sourceMap) {
- // TODO(johnniwinther): Support source map from .dill.
- return;
- }
- Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType];
- checkSets(map1.keys, map2.keys, 'output', equality);
- map1.forEach((String name, BufferedOutputSink output1) {
- BufferedOutputSink output2 = map2[name];
- Expect.stringEquals(output1.text, output2.text);
- });
- });
- }
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
index 7c5101a..4a93fec 100644
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ b/tests/compiler/dart2js/kernel/compiler_helper.dart
@@ -11,17 +11,12 @@
import 'package:compiler/compiler_new.dart';
import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/common/tasks.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/dart2js.dart' as dart2js;
import 'package:compiler/src/filenames.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/library_loader.dart';
import 'package:compiler/src/universe/world_builder.dart';
import 'package:compiler/src/util/util.dart';
import 'package:expect/expect.dart';
-import 'package:kernel/ast.dart' as ir;
import 'package:sourcemap_testing/src/stacktrace_helper.dart';
import '../memory_compiler.dart';
@@ -60,19 +55,6 @@
return new Pair<Compiler, Compiler>(result1.compiler, result2.compiler);
}
-class MemoryKernelLibraryLoaderTask extends KernelLibraryLoaderTask {
- final ir.Component component;
-
- MemoryKernelLibraryLoaderTask(KernelToElementMapForImpact elementMap,
- DiagnosticReporter reporter, Measurer measurer, this.component)
- : super(null, null, null, elementMap, null, reporter, measurer);
-
- Future<LoadedLibraries> loadLibrary(Uri resolvedUri,
- {bool skipFileWithPartOfTag: false}) async {
- return createLoadedLibraries(component);
- }
-}
-
Future createTemp(Uri entryPoint, Map<String, String> memorySourceFiles,
{bool printSteps: false}) async {
if (memorySourceFiles.isNotEmpty) {
diff --git a/tests/compiler/dart2js/kernel/constructors_test.dart b/tests/compiler/dart2js/kernel/constructors_test.dart
deleted file mode 100644
index bf7c564..0000000
--- a/tests/compiler/dart2js/kernel/constructors_test.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart' show Compiler;
-import 'package:compiler/src/elements/entities.dart';
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('simple default constructor', () {
- String code = '''
-class A {
-}
-
-main() {
- var a = new A();
- return a;
-}''';
- return check(code, lookup: defaultConstructorFor('A'));
- });
-
- test('simple default constructor with field', () {
- String code = '''
-class A {
- int x = 1;
-}
-
-main() {
- var a = new A();
- return a;
-}''';
- return check(code, lookup: defaultConstructorFor('A'));
- });
-
- test('redirecting constructor with field', () {
- String code = '''
-class Foo {
- final int value;
- const Foo({int number: 0}) : this.poodle(number * 2);
- const Foo.poodle(this.value);
-}
-
-main() => new Foo(number: 3);
-''';
- return check(code, lookup: defaultConstructorFor('Foo'));
- });
-
- // TODO(efortuna): Kernel needs to have some additional constructor
- // implementation work before this is legitimately equivalent code to the
- // original AST.
-/* test('initialized field and constructor', () {
- String code = '''
-import 'dart:_foreign_helper' show JS, JS_EMBEDDED_GLOBAL;
-import 'package:expect/expect.dart';
-
-
-class Foo {
- final value = JS('bool', '#()', JS_EMBEDDED_GLOBAL('', 'foo'));
- Foo() {
- print('hello world');
- }
-}
-
-main() => new Foo();
-''';
- return check(code, lookup: defaultConstructorFor('Foo'));
- });*/
-}
-
-defaultConstructorFor(String className) => (Compiler compiler) {
- ElementEnvironment elementEnvironment =
- compiler.backendClosedWorldForTesting.elementEnvironment;
- LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
- ClassEntity clazz =
- elementEnvironment.lookupClass(mainLibrary, className);
- return elementEnvironment.lookupConstructor(clazz, '');
- };
diff --git a/tests/compiler/dart2js/kernel/control_flow_test.dart b/tests/compiler/dart2js/kernel/control_flow_test.dart
deleted file mode 100644
index c6ffe84..0000000
--- a/tests/compiler/dart2js/kernel/control_flow_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile control flow', () {
- test('simple if statement', () {
- String code = '''
- main() {
- if (true) {
- return 1;
- } else {
- return 2;
- }
- }''';
- return check(code);
- });
- test('simple if statement no else', () {
- String code = '''
- main() {
- if (true) {
- return 1;
- }
- }''';
- return check(code);
- });
- test('simple dead if statement', () {
- String code = '''
- main() {
- if (false) {
- return 1;
- }
- }''';
- return check(code);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/empty_test.dart b/tests/compiler/dart2js/kernel/empty_test.dart
deleted file mode 100644
index f3fe00b..0000000
--- a/tests/compiler/dart2js/kernel/empty_test.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('compile empty function', () {
- return check("main() {}");
- });
-}
diff --git a/tests/compiler/dart2js/kernel/expressions_test.dart b/tests/compiler/dart2js/kernel/expressions_test.dart
deleted file mode 100644
index 7074c4c..0000000
--- a/tests/compiler/dart2js/kernel/expressions_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('string literals', () {
- test('juxtaposition', () {
- return check('main() { return "abc" "def"; }');
- });
- test('literal interpolation', () {
- return check('main() { return "abc\${1}def"; }');
- });
- test('complex interpolation', () {
- String code = '''
-foo() => 1;
-main() => "abc\${foo()}"
- "\${foo()}def";''';
- return check(code);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/getters_setters_test.dart b/tests/compiler/dart2js/kernel/getters_setters_test.dart
deleted file mode 100644
index 31a3809..0000000
--- a/tests/compiler/dart2js/kernel/getters_setters_test.dart
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile getters with kernel', () {
- test('top-level', () {
- String code = '''
-int get foo => 1;
-main() => foo;
-''';
- return check(code);
- });
-
- test('static', () {
- String code = '''
-class A {
- static int get foo => 1;
-}
-main() => A.foo;
-''';
- return check(code);
- });
-
- test('super get', () {
- String code = '''
-class A {
- int get foo => 1;
-}
-
-class B extends A {
-
- int get rotations => super.foo * 3;
-}
-
-main() => new B().foo;
-''';
- return check(code);
- });
-
- test('super get no such method', () {
- String code = '''
-class A {
- static int get foo => 1;
-}
-
-class B extends A {
-
- int get rotations => super.nothing * 3;
-}
-
-main() => new B().foo;
-''';
- return check(code);
- });
- });
-
- group('compile setters with kernel', () {
- test('top-level', () {
- String code = '''
-set foo(int newFoo) {
- // do nothing
-}
-main() {
- foo = 1;
-}''';
- return check(code);
- });
-
- test('static', () {
- String code = '''
-class A {
- static set foo(int newFoo) {
- // do nothing
- }
-}
-main() {
- A.foo = 1;
-}
-''';
- return check(code);
- });
- });
-
- test('super set', () {
- String code = '''
-class A {
- set ferocious(int newFerocious) {}
-}
-
-class B extends A {
- bar() {
- super.ferocious = 87;
- }
-}
-main() {
- new B().bar();
-}''';
- return check(code);
- });
-
- test('super set no such method', () {
- String code = '''
-class A {
- final ferocious = 0;
- noSuchMethod(_) => 42;
-}
-
-class B extends A {
- bar() {
- super.ferocious = 87;
- }
-}
-main() {
- new B().bar();
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/helper.dart b/tests/compiler/dart2js/kernel/helper.dart
deleted file mode 100644
index b8e6ae9..0000000
--- a/tests/compiler/dart2js/kernel/helper.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart' show Compiler;
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/js_backend/backend.dart' as js
- show JavaScriptBackend;
-import 'package:compiler/src/commandline_options.dart' show Flags;
-import 'package:js_ast/js_ast.dart' as jsAst;
-import 'package:test/test.dart';
-
-import '../equivalence/check_functions.dart';
-import '../memory_compiler.dart';
-
-Future<jsAst.Expression> compile(String code,
- {dynamic lookup: 'main',
- bool useKernel: false,
- bool disableTypeInference: true,
- List<String> extraOptions: const <String>[]}) async {
- List<String> options = <String>[
- Flags.disableInlining,
- ];
- if (disableTypeInference) options.add(Flags.disableTypeInference);
- if (!useKernel) options.add(Flags.useOldFrontend);
- options.addAll(extraOptions);
-
- if (lookup is String && lookup != 'main' && !code.contains('main')) {
- code = "$code\n\nmain() => $lookup;";
- }
- CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code}, options: options);
- expect(result.isSuccess, isTrue);
- Compiler compiler = result.compiler;
- ElementEnvironment elementEnvironment =
- compiler.backendClosedWorldForTesting.elementEnvironment;
- MemberEntity element;
- if (lookup is String) {
- LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
- element = elementEnvironment.lookupLibraryMember(mainLibrary, lookup);
- } else {
- element = lookup(compiler);
- }
- js.JavaScriptBackend backend = compiler.backend;
- return backend.generatedCode[element];
-}
-
-/// Checks that the given Dart [code] compiles to the same JS in kernel and
-/// normal mode.
-///
-/// The function to check at the end is given by [lookup]. If [lookup] is a
-/// String, then the generated code for a top-level element named [lookup] is
-/// checked. Otherwise, [lookup] is a function that takes a [Compiler] and
-/// returns an [MemberEntity], and the returned [MemberEntity] is checked.
-Future check(String code,
- {dynamic lookup: 'main',
- bool disableTypeInference: true,
- List<String> extraOptions: const <String>[]}) async {
- jsAst.Expression original = await compile(code,
- lookup: lookup,
- disableTypeInference: disableTypeInference,
- extraOptions: extraOptions);
- jsAst.Expression kernel = await compile(code,
- lookup: lookup,
- useKernel: true,
- disableTypeInference: disableTypeInference,
- extraOptions: extraOptions);
- expect(areJsNodesEquivalent(original, kernel), isTrue);
-}
diff --git a/tests/compiler/dart2js/kernel/literals_test.dart b/tests/compiler/dart2js/kernel/literals_test.dart
deleted file mode 100644
index 5cc337a..0000000
--- a/tests/compiler/dart2js/kernel/literals_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('compile function that returns a literal list', () {
- return check('main() { return [1, 2, 3]; }');
- });
- test('compile function that returns a const list', () {
- return check('main() { return const [1, 2, 3]; }');
- });
- test('compile function that returns a literal map', () {
- return check('main() { return {"a": 1, "b": 2, "c": 3}; }');
- });
- test('compile function that returns a const map', () {
- return check('main() { return const {"a": 1, "b": 2, "c": 3}; }');
- });
- test('compile top level string field ', () {
- return check('String foo = (() { return "a";})(); main() { return foo; }');
- });
-}
diff --git a/tests/compiler/dart2js/kernel/loops_test.dart b/tests/compiler/dart2js/kernel/loops_test.dart
deleted file mode 100644
index 259539b..0000000
--- a/tests/compiler/dart2js/kernel/loops_test.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('for loop', () {
- String code = '''
-main() {
- var a = 0;
- for (var i = 0; i < 10; i++) {
- a += i;
- }
- return a;
-}''';
- return check(code);
- });
-
- test('while loop', () {
- String code = '''
-main() {
- var a = 0;
- while (a < 100) {
- a *= 2;
- }
- return a;
-}''';
- return check(code);
- });
-
- test('do-while loop', () {
- String code = '''
-main() {
- var a = 0;
- do {
- a *= 2;
- } while (a < 100);
- return a;
-}''';
- return check(code);
- });
-
- test('for-in loop', () {
- String code = '''
-main() {
- var sum = 0;
- for (var a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- return check(code);
- });
-
- test('for-in loop optimized', () {
- String code = '''
-main() {
- var sum = 0;
- for (var a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- // This is the same test as above, but by enabling type inference
- // we allow the compiler to detect that it can iterate over the
- // array using indexing.
- return check(code, disableTypeInference: false);
- });
-
- test('for-in loop top-level variable', () {
- String code = '''
-var a = 0;
-main() {
- var sum = 0;
- for (a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- return check(code, disableTypeInference: false);
- });
-
- test('for loop with break to label', () {
- String code = '''
-main() {
- var sum = 0;
- outer: for (var a in [1, 2, 3]) {
- for (int i = 0; i < 10; i++) {
- sum += a;
- if (a + i < 5)
- break outer;
- }
- }
- return sum;
-}''';
- return check(code, disableTypeInference: false);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/mixin_test.dart b/tests/compiler/dart2js/kernel/mixin_test.dart
deleted file mode 100644
index 62e4dfa..0000000
--- a/tests/compiler/dart2js/kernel/mixin_test.dart
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test that the optimized algorithm for mixin applications matches the mixins
-// generated by fasta.
-library dart2js.kernel.mixins_test;
-
-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/compiler.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/class_set.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_helpers.dart';
-import 'test_helpers.dart';
-import 'compiler_helper.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-
-class Super {}
-class Mixin1 {}
-class Mixin2 {}
-class Sub1 extends Super with Mixin1 {}
-class Sub2 extends Super with Mixin1, Mixin2 {}
-class NamedSub1 = Super with Mixin1;
-class NamedSub2 = Super with Mixin1, Mixin2;
-
-
-class GenericSuper<T> {}
-class GenericMixin1<T> {}
-class GenericMixin2<T> {}
-class GenericSub1<T> extends GenericSuper<T> with GenericMixin1<T> {}
-class GenericSub2<T> extends GenericSuper<T>
- with GenericMixin1<T>, GenericMixin2<T> {}
-class GenericNamedSub1<T> = GenericSuper<T> with GenericMixin1<T>;
-class GenericNamedSub2<T> = GenericSuper<T>
- with GenericMixin1<T>, GenericMixin2<T>;
-
-class FixedSub1a extends GenericSuper<int> with GenericMixin1<int> {}
-class FixedSub1b extends GenericSuper<int> with GenericMixin1<double> {}
-class FixedSub2a extends GenericSuper<int>
- with GenericMixin1<int>, GenericMixin2<int> {}
-class FixedSub2b extends GenericSuper<double>
- with GenericMixin1<double>, GenericMixin2<double> {}
-
-class GenericMultiMixin<T, S> {}
-class GenericSub<T, S> = Object with GenericMultiMixin<T, S>;
-class FixedSub = Object with GenericMultiMixin<int, String>;
-
-
-main() {
- new Super();
- new Mixin1();
- new Mixin2();
- new Sub1();
- new Sub2();
- new NamedSub1();
- new NamedSub2();
-
- new GenericSuper<int>();
- new GenericMixin1<int>();
- new GenericMixin2<int>();
- new GenericSub1<int>();
- new GenericSub2<int>();
- new GenericNamedSub1<int>();
- new GenericNamedSub2<int>();
-
- new FixedSub1a();
- new FixedSub1b();
- new FixedSub2a();
- new FixedSub2b();
-
- new GenericSub<int, String>();
- new FixedSub();
-}
-'''
-};
-
-Map<ClassEntity, String> generateClassEnv(
- ElementEnvironment env, DartTypes types) {
- Map<ClassEntity, String> classEnv = <ClassEntity, String>{};
-
- void createEnv(ClassEntity cls) {
- classEnv.putIfAbsent(cls, () {
- InterfaceType thisType = env.getThisType(cls);
- StringBuffer sb = new StringBuffer();
- sb.write('class ');
- sb.write(env.getThisType(cls));
- ClassEntity superclass = env.getSuperClass(cls);
- if (superclass != null) {
- createEnv(superclass);
- sb.write(' extends ');
- sb.write(types.asInstanceOf(thisType, superclass));
- }
- return sb.toString();
- });
- }
-
- env.forEachClass(env.mainLibrary, createEnv);
-
- return classEnv;
-}
-
-main(List<String> args) {
- asyncTest(() async {
- Uri entryPoint = await createTemp(Uri.parse('memory:main.dart'), SOURCE,
- printSteps: true);
-
- print(
- '---- compiler from ast -----------------------------------------------');
- var result = await runCompiler(
- entryPoint: entryPoint,
- options: [Flags.analyzeOnly, Flags.useOldFrontend]);
- Compiler compiler1 = result.compiler;
-
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- memorySourceFiles: {},
- options: [Flags.analyzeOnly],
- printSteps: true);
-
- ElementEnvironment env1 = compiler1.frontendStrategy.elementEnvironment;
- DartTypes types1 = compiler1.frontendStrategy.dartTypes;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- ElementEnvironment env2 = frontendStrategy.elementEnvironment;
- DartTypes types2 = frontendStrategy.dartTypes;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
-
- KernelEquivalence equivalence =
- new KernelEquivalence(frontendStrategy.elementMap);
-
- if (args.contains('-v')) {
- Map<ClassEntity, String> classEnv1 = generateClassEnv(env1, types1);
- Map<ClassEntity, String> classEnv2 = generateClassEnv(env2, types2);
-
- print('----');
- classEnv1.forEach((ClassEntity cls, String env) {
- print(env);
- });
- print('----');
- classEnv2.forEach((ClassEntity cls, String env) {
- print(env);
- });
- }
-
- void checkClasses(ClassEntity cls1, ClassEntity cls2) {
- if (cls1 == cls2) return;
- Expect.isNotNull(cls1, 'Missing class ${cls2.name}');
- Expect.isNotNull(cls2, 'Missing class ${cls1.name}');
-
- check(cls1.library, cls2.library, 'class ${cls1.name}', cls1, cls2,
- equivalence.entityEntityEquivalence);
- InterfaceType thisType1 = types1.getThisType(cls1);
- InterfaceType thisType2 = types2.getThisType(cls2);
- check(cls1, cls2, 'thisType', thisType1, thisType2,
- equivalence.typeTypeEquivalence);
- check(cls1, cls2, 'supertype', types1.getSupertype(cls1),
- types2.getSupertype(cls2), equivalence.typeTypeEquivalence);
- checkClasses(env1.getSuperClass(cls1), env2.getSuperClass(cls2));
-
- List<DartType> mixins1 = <DartType>[];
- env1.forEachMixin(cls1, (ClassEntity mixin) {
- mixins1.add(types1.asInstanceOf(thisType1, mixin));
- });
- List<DartType> mixins2 = <DartType>[];
- env2.forEachMixin(cls2, (ClassEntity mixin) {
- mixins2.add(types2.asInstanceOf(thisType2, mixin));
- });
- checkLists(mixins1, mixins2, '${cls1.name} mixins',
- equivalence.typeTypeEquivalence);
-
- checkLists(
- types1.getInterfaces(cls1).toList(),
- types2.getInterfaces(cls2).toList(),
- '${cls1.name} interfaces',
- equivalence.typeTypeEquivalence);
- checkLists(
- types1.getSupertypes(cls1).toList(),
- types2.getSupertypes(cls2).toList(),
- '${cls1.name} supertypes',
- equivalence.typeTypeEquivalence);
-
- if (cls1 == compiler1.frontendStrategy.commonElements.objectClass) return;
-
- ClassHierarchyNode node1 = closedWorld1.getClassHierarchyNode(cls1);
- ClassHierarchyNode node2 = closedWorld2.getClassHierarchyNode(cls2);
- checkSets(
- new Set.from(node1.directSubclasses),
- new Set.from(node2.directSubclasses),
- '${cls1.name} direct subclasses',
- (a, b) => equivalence.entityEquivalence(a.cls, b.cls));
- }
-
- env1.forEachClass(env1.mainLibrary, (ClassEntity cls1) {
- ClassEntity cls2 = env2.lookupClass(env2.mainLibrary, cls1.name);
- checkClasses(cls1, cls2);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/run_from_dill_test.dart b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
deleted file mode 100644
index 29e526e..0000000
--- a/tests/compiler/dart2js/kernel/run_from_dill_test.dart
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test that we can compile from dill and run the generated code with d8.
-library dart2js.kernel.run_from_dill_test;
-
-import 'dart:async';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-
-import 'arguments.dart';
-import 'compiler_helper.dart';
-
-const SOURCE = const {
- 'main.dart': r'''
-import "package:expect/expect.dart";
-
-class K {}
-
-class A<T> {
- foo() {
- bar() => T;
- return bar();
- }
-}
-
-class B extends A<K> {}
-
-class X<T> {}
-
-// [globalMethod] and [format] are copied from
-// `language/named_parameters_with_dollars_test`. This test failed because
-// when inlining [globalMethod] the named arguments where processed unsorted,
-// passing `[a, a$b, a$$b, b]` to [format] instead of `[a, b, a$b, a$$b]`.
-globalMethod({a, b, a$b, a$$b}) => [a, b, a$b, a$$b];
-
-format(thing) {
- if (thing == null) return '-';
- if (thing is List) {
- var fragments = ['['];
- var sep;
- for (final item in thing) {
- if (sep != null) fragments.add(sep);
- sep = ', ';
- fragments.add(format(item));
- }
- fragments.add(']');
- return fragments.join();
- }
- return thing.toString();
-}
-
-main() {
- for (int i = 0; i < 10; i++) {
- if (i == 5) continue;
- print('Hello World: $i!');
- if (i == 7) break;
- }
- Expect.equals(new A<int>().foo(), int);
- var v = new DateTime.now().millisecondsSinceEpoch != 42
- ? new X<B>()
- : new X<A<String>>();
- Expect.isFalse(v is X<A<String>>);
- Expect.equals('[1, 2, -, -]', format(globalMethod(a: 1, b: 2)));
-}
-'''
-};
-
-const OUTPUT = '''
-Hello World: 0!
-Hello World: 1!
-Hello World: 2!
-Hello World: 3!
-Hello World: 4!
-Hello World: 6!
-Hello World: 7!
-''';
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- await runWithD8(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: [Flags.enableAssertMessage],
- expectedOutput: OUTPUT);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/simple_function_test.dart b/tests/compiler/dart2js/kernel/simple_function_test.dart
deleted file mode 100644
index d58ca33..0000000
--- a/tests/compiler/dart2js/kernel/simple_function_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile function that returns a value', () {
- test('constant int', () {
- return check('main() { return 1; }');
- });
-
- test('constant double', () {
- return check('main() { return 1.0; }');
- });
-
- test('constant string', () {
- return check('main() { return "hello"; }');
- });
-
- test('constant bool', () {
- return check('main() { return true; }');
- });
-
- test('constant symbol', () {
- return check('main() { return #hello; }');
- });
-
- test('null', () {
- return check('main() { return null; }');
- });
- });
-
- test('compile function that returns its argument', () {
- String code = '''
- foo(x) {
- return x;
- }
-
- main() {
- foo(1);
- }''';
- return check(code, lookup: 'foo');
- });
-}
diff --git a/tests/compiler/dart2js/kernel/switch_test.dart b/tests/compiler/dart2js/kernel/switch_test.dart
deleted file mode 100644
index 1ae2ceb..0000000
--- a/tests/compiler/dart2js/kernel/switch_test.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('simple switch statement', () {
- String code = '''
-main() {
- int x = 2;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- break;
- }
-}''';
- return check(code);
- });
-
- test('switch with default', () {
- String code = '''
-main() {
- int x = 5;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- break;
- default:
- print('ladybug');
- }
-}''';
- return check(code);
- });
-
-/*
- // TODO(efortuna): Uncomment. Because of patch file weirdness, the original
- // SSA vs the Kernel version is instantiating a subclass of the
- // FallThroughError, so it produces slightly different code. Fix that.
- test('switch with fall through error', () {
- String code = '''
-main() {
- int x = 2;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- case 3:
- print('ant');
- break;
- default:
- print('ladybug');
- }
-}''';
- return check(code);
- });
-*/
- test('switch with multi-case branch', () {
- String code = '''
-main() {
- int x = 3;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- case 3:
- case 4:
- print('grasshopper');
- print('ant');
- break;
- }
-}''';
- return check(code);
- });
-
- test('switch with weird fall-through end case', () {
- String code = '''
-main() {
- int x = 6;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 5:
- print('beetle');
- break;
- case 6:
- }
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/try_catch_test.dart b/tests/compiler/dart2js/kernel/try_catch_test.dart
deleted file mode 100644
index 77a1afd..0000000
--- a/tests/compiler/dart2js/kernel/try_catch_test.dart
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('try catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } catch (e, s) {
- print(e);
- print(s);
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try omit catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on ArgumentError {
- print('howdy');
- }
-}''';
- return check(code);
- });
-
- test('try finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try catch finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } catch(e) {
- print('howdy');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try multi catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on String catch(e) {
- print('hola');
- } on int catch(e) {
- print('halo');
- } catch (e) {
- print('howdy');
- }
-}''';
- return check(code);
- });
-
- test('try multi-catch finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on String catch(e) {
- print('hola');
- } on int catch(e) {
- print('halo');
- } catch (e) {
- print('howdy');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
index 8fa15e2..e014671 100644
--- a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
+++ b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
@@ -11,7 +11,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/compile_time_constants.dart';
import 'package:compiler/src/constants/constructors.dart';
import 'package:compiler/src/constants/evaluation.dart';
import 'package:compiler/src/constants/expressions.dart';
@@ -645,38 +644,14 @@
});
}
- const skipAstList = const [
- // The old front end reports errors through the compile time constant
- // evaluator which results in different constant expressions for errorneous
- // constants.
- 'errors',
- // Assert in initializer is not supported by the old frontend.
- 'assert',
- ];
- const skipKernelList = const [
- // TODO(johnniwinther): Investigate why some types of the constructed
- // objects don't match.
- 'redirect',
- ];
+ const skipKernelList = const [];
const skipStrongList = const [
- // TODO(johnniwinther): Investigate why some types of the constructed
- // objects don't match.
- 'redirect',
// TODO(johnniwinther): Investigate why different errors are reported in
// strong mode.
'errors',
];
- if (!skipAstList.contains(data.name) && !data.strongModeOnly) {
- print(
- '--test ast----------------------------------------------------------');
- await runTest(
- [Flags.useOldFrontend],
- (Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
- compiler,
- constantRequired: field.isConst));
- }
if (!skipKernelList.contains(data.name) && !data.strongModeOnly) {
print(
'--test kernel-------------------------------------------------------');
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
index 8739e8f..a909569 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
@@ -10,7 +10,7 @@
@NoInline()
test(c) {
- /*ast.2:test*/ c. /*kernel.2:test*/ field.method();
+ c. /*2:test*/ field.method();
}
class Class {
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
index 8f35b5f..011af16 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
@@ -13,8 +13,7 @@
confuse([]).length;
confuse(new MyType()).length;
// TODO(johnniwinther): Intercepted access should point to 'length':
- /*ast.1:main*/ confuse(null)
- . /*kernel.1:main*/ length; // called through the interceptor
+ confuse(null). /*1:main*/ length; // called through the interceptor
}
@NoInline()
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
index 50035b4..81f88bb 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
@@ -8,11 +8,11 @@
/*1:main*/ test();
}
-test() async /*ast.2:test*/ {
+test() async {
// TODO(johnniwinther): Investigate why kernel doesn't point to the body
// start brace.
// ignore: UNUSED_LOCAL_VARIABLE
- var /*kernel.2:test*/ c = new /*3:test*/ Class();
+ var /*2:test*/ c = new /*3:test*/ Class();
}
class Class {
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index 1a815d9..6a30c60 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -8,7 +8,6 @@
import 'package:args/args.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/dart2js.dart' as entry;
import 'package:sourcemap_testing/src/stacktrace_helper.dart';
@@ -46,16 +45,12 @@
});
}
-const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
Future testAnnotatedCode(String code,
{bool printJs: false, bool writeJs: false, bool verbose: false}) async {
- Test test = processTestCode(code, [astMarker, kernelMarker]);
+ Test test = processTestCode(code, [kernelMarker]);
print(test.code);
- print('---from ast---------------------------------------------------------');
- await runTest(test, astMarker,
- printJs: printJs, writeJs: writeJs, verbose: verbose);
print('---from kernel------------------------------------------------------');
await runTest(test, kernelMarker,
printJs: printJs, writeJs: writeJs, verbose: verbose);
@@ -79,12 +74,8 @@
'-o$output',
'--library-root=sdk',
'--packages=${Platform.packageConfig}',
- Flags.useNewSourceInfo,
input,
]..addAll(options);
- if (config == astMarker) {
- arguments.add(Flags.useOldFrontend);
- }
print("Compiling dart2js ${arguments.join(' ')}");
CompilationResult compilationResult = await entry.internalMain(arguments);
return compilationResult.isSuccess;
diff --git a/tests/compiler/dart2js/sourcemaps/stepping_test.dart b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
index 4738bbc..c8610e0 100644
--- a/tests/compiler/dart2js/sourcemaps/stepping_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
@@ -44,7 +44,6 @@
});
}
-const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
Future testAnnotatedCode(String code,
@@ -53,9 +52,7 @@
new AnnotatedCode.fromText(code, commentStart, commentEnd);
print(annotatedCode.sourceCode);
Map<String, AnnotatedCode> split =
- splitByPrefixes(annotatedCode, [astMarker, kernelMarker]);
- print('---from ast---------------------------------------------------------');
- await runTest(split[astMarker], astMarker, debug: debug, verbose: verbose);
+ splitByPrefixes(annotatedCode, [kernelMarker]);
print('---from kernel------------------------------------------------------');
await runTest(split[kernelMarker], kernelMarker,
debug: debug, verbose: verbose);
@@ -75,10 +72,6 @@
inputFile,
Flags.disableInlining,
];
- if (config == astMarker) {
- arguments.add(Flags.useOldFrontend);
- arguments.add(Flags.useNewSourceInfo);
- }
CompilationResult compilationResult = await entry.internalMain(arguments);
Expect.isTrue(compilationResult.isSuccess);
List<String> scriptD8Command = [