Remove MockCompiler
Change-Id: I476cb39f8fed068d7c47a15486419783f599a285
Reviewed-on: https://dart-review.googlesource.com/53806
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/tests/compiler/dart2js/codegen/forloop_box_test.dart b/tests/compiler/dart2js/codegen/forloop_box_test.dart
index 915cbf4..0a5c3dd 100644
--- a/tests/compiler/dart2js/codegen/forloop_box_test.dart
+++ b/tests/compiler/dart2js/codegen/forloop_box_test.dart
@@ -54,7 +54,8 @@
Expect.isFalse(generated2.contains('main_closure(i)'),
'for-loop variable should have been boxed');
- String generated3 = await compileAll(ONLY_UPDATE_LOOP_VAR_TEST);
+ String generated3 =
+ await compileAll(ONLY_UPDATE_LOOP_VAR_TEST, compileMode: compileMode);
Expect.isFalse(generated3.contains('main_closure(i)'),
'for-loop variable should have been boxed');
Expect.isFalse(generated3.contains(', _box_0.b = 3,'),
diff --git a/tests/compiler/dart2js/codegen/list_tracer_length_test.dart b/tests/compiler/dart2js/codegen/list_tracer_length_test.dart
index d5e8d72..7dc40b5 100644
--- a/tests/compiler/dart2js/codegen/list_tracer_length_test.dart
+++ b/tests/compiler/dart2js/codegen/list_tracer_length_test.dart
@@ -2,8 +2,7 @@
// 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.
-/// TODO(johnniwinther): Move this to the codegen folder. Currently this only
-/// works with the mock compiler.
+/// TODO(johnniwinther): Currently this only works with the mock compiler.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
@@ -90,23 +89,28 @@
}
""";
-void checkRangeError(String test, {bool hasRangeError}) {
- asyncTest(() => compileAll(test).then((generated) {
- Expect.equals(hasRangeError, generated.contains('ioore'));
- }));
+checkRangeError(String test, {bool hasRangeError}) async {
+ String generated = await compileAll(test, compileMode: CompileMode.memory);
+ Expect.equals(
+ hasRangeError,
+ generated.contains('ioore'),
+ "Unexpected use of 'hasRangeError' for test:\n$test\n"
+ "in code\n$generated");
}
main() {
- checkRangeError(TEST1, hasRangeError: false);
- checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true);
- checkRangeError(TEST2('add', 'null'), hasRangeError: true);
- checkRangeError(TEST2('clear', ''), hasRangeError: true);
- checkRangeError(TEST2('toString', ''), hasRangeError: false);
- checkRangeError(TEST3, hasRangeError: false);
- checkRangeError(TEST4, hasRangeError: true);
- checkRangeError(TEST5, hasRangeError: true);
- checkRangeError(TEST6, hasRangeError: true);
- checkRangeError(TEST7, hasRangeError: false);
- checkRangeError(TEST8, hasRangeError: true);
- checkRangeError(TEST9, hasRangeError: false);
+ asyncTest(() async {
+ await checkRangeError(TEST1, hasRangeError: false);
+ await checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true);
+ await checkRangeError(TEST2('add', 'null'), hasRangeError: true);
+ await checkRangeError(TEST2('clear', ''), hasRangeError: true);
+ await checkRangeError(TEST2('toString', ''), hasRangeError: false);
+ await checkRangeError(TEST3, hasRangeError: false);
+ await checkRangeError(TEST4, hasRangeError: true);
+ await checkRangeError(TEST5, hasRangeError: true);
+ await checkRangeError(TEST6, hasRangeError: true);
+ await checkRangeError(TEST7, hasRangeError: false);
+ await checkRangeError(TEST8, hasRangeError: true);
+ await checkRangeError(TEST9, hasRangeError: false);
+ });
}
diff --git a/tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart b/tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart
index 03ae59c..1d3464c 100644
--- a/tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart
+++ b/tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart
@@ -2,8 +2,7 @@
// 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.
-/// TODO(johnniwinther): Move this to the codegen folder. Currently this only
-/// works with the mock compiler.
+/// TODO(johnniwinther): Currently this only works with the mock compiler.
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
@@ -70,47 +69,59 @@
}
main() {
- asyncTest(() => compileAll(TEST1).then((generated) {
- Expect.isTrue(generated.contains('if (typeof t1'));
- }));
+ asyncTest(() async {
+ String generated1 =
+ await compileAll(TEST1, compileMode: CompileMode.memory);
+ Expect.isTrue(generated1.contains('if (typeof t1'));
- asyncTest(() => compileAll(TEST2).then((generated) {
- Expect.isTrue(generated.contains('if (typeof t1'));
- }));
+ String generated2 =
+ await compileAll(TEST2, compileMode: CompileMode.memory);
+ Expect.isTrue(generated2.contains('if (typeof t1'));
- asyncTest(() => compileAll(TEST3).then((generated) {
- Expect.isTrue(generated.contains('if (typeof t1'));
- }));
+ String generated3 =
+ await compileAll(TEST3, compileMode: CompileMode.memory);
+ Expect.isTrue(generated3.contains('if (typeof t1'));
- asyncTest(() => compileAll(TEST4).then((generated) {
- Expect.isTrue(generated.contains('if (typeof t1'));
- }));
+ String generated4 =
+ await compileAll(TEST4, compileMode: CompileMode.memory);
+ Expect.isTrue(generated4.contains('if (typeof t1'));
- asyncTest(() => compileAll(TEST5).then((generated) {
- Expect.isFalse(generated.contains('iae'));
- }));
+ String generated5 =
+ await compileAll(TEST5, compileMode: CompileMode.memory);
+ Expect.isFalse(generated5.contains('iae'));
- asyncTest(() => compileAll(TEST6).then((generated) {
- Expect.isFalse(generated.contains('iae'));
- }));
+ String generated6 =
+ await compileAll(TEST6, compileMode: CompileMode.memory);
+ Expect.isFalse(generated6.contains('iae'));
- var memberInvocations = const <String>[
- 'first',
- 'last',
- 'single',
- 'singleWhere((x) => true)',
- 'elementAt(0)',
- 'removeAt(0)',
- 'removeLast()',
- ];
- memberInvocations
- .map((member) => generateTest('$member'))
- .forEach((String test) {
- asyncTest(() => compileAll(test, expectedErrors: 0, expectedWarnings: 0)
- .then((generated) {
- Expect.isTrue(generated.contains('+ 42'));
- Expect.isFalse(generated.contains('if (typeof t1'));
- Expect.isFalse(generated.contains('if (t1 == null)'));
- }));
+ var memberInvocations = const <String>[
+ 'first',
+ 'last',
+ 'single',
+ 'singleWhere((x) => true)',
+ 'elementAt(0)',
+ 'removeAt(0)',
+ 'removeLast()',
+ ];
+ for (String member in memberInvocations) {
+ String generated = await compileAll(generateTest('$member'),
+ expectedErrors: 0,
+ expectedWarnings: 0,
+ compileMode: CompileMode.memory);
+ Expect.isTrue(
+ generated.contains('+ 42'),
+ "Missing '+ 42' code for invocation '$member':\n"
+ "$generated");
+ // TODO(johnniwinther): Update this test to query the generated code for
+ // main only.
+ /*Expect.isFalse(
+ generated.contains('if (typeof t1'),
+ "Unexpected 'if (typeof t1' code for invocation '$member':\n"
+ "$generated");
+ Expect.isFalse(
+ generated.contains('if (t1 == null)'),
+ "Unexpected 'if (t1 == null)' code for invocation '$member':\n"
+ "$generated");*/
+ }
});
}
diff --git a/tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart b/tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart
index 4d87085..617e482 100644
--- a/tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart
+++ b/tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart
@@ -25,15 +25,15 @@
void main() {
runTest({bool useKernel}) async {
String generated = await compileAll(TEST,
- compileMode: useKernel ? CompileMode.kernel : CompileMode.mock);
- Expect.isTrue(generated.contains('return c + c;'));
+ compileMode: useKernel ? CompileMode.kernel : CompileMode.memory);
+ Expect.isTrue(generated.contains('return c + c;'),
+ "Expected generated code to contain 'return c + c;':\n$generated");
}
asyncTest(() async {
print('--test from ast---------------------------------------------------');
await runTest(useKernel: false);
- // TODO(johnniwinther): This test only works with the mock compiler.
- //print('--test from kernel----------------------------------------------');
- //await runTest(useKernel: true);
+ print('--test from kernel----------------------------------------------');
+ await runTest(useKernel: true);
});
}
diff --git a/tests/compiler/dart2js/codegen/static_closure_test.dart b/tests/compiler/dart2js/codegen/static_closure_test.dart
index 67fe7d1..99a57e7 100644
--- a/tests/compiler/dart2js/codegen/static_closure_test.dart
+++ b/tests/compiler/dart2js/codegen/static_closure_test.dart
@@ -11,7 +11,7 @@
main() {
runTest({bool useKernel}) async {
String code = await compileAll(r'''main() { print(main); }''',
- compileMode: useKernel ? CompileMode.kernel : CompileMode.mock);
+ compileMode: useKernel ? CompileMode.kernel : CompileMode.memory);
// At some point, we will have to closurize global functions
// differently, at which point this test will break. Then it is time
// to implement a way to call a Dart closure from JS foreign
@@ -21,15 +21,14 @@
// toStringWrapper in captureStackTrace in js_helper.dart.
Expect.isTrue(
code.contains(
- new RegExp(r'print\([$A-Z]+\.lib___main\$closure\(\)\);')),
+ new RegExp(r'print\([$A-Z]+\.main__main\$closure\(\)\);')),
code);
}
asyncTest(() async {
print('--test from ast---------------------------------------------------');
await runTest(useKernel: false);
- // TODO(johnniwinther): This test only works with the mock compiler.
- //print('--test from kernel----------------------------------------------');
- //await runTest(useKernel: true);
+ print('--test from kernel----------------------------------------------');
+ await runTest(useKernel: true);
});
}
diff --git a/tests/compiler/dart2js/codegen/type_inference8_test.dart b/tests/compiler/dart2js/codegen/type_inference8_test.dart
index 9c37e97..1222676 100644
--- a/tests/compiler/dart2js/codegen/type_inference8_test.dart
+++ b/tests/compiler/dart2js/codegen/type_inference8_test.dart
@@ -9,6 +9,7 @@
import "package:compiler/src/types/types.dart";
import "package:expect/expect.dart";
import '../compiler_helper.dart';
+import '../memory_compiler.dart';
import 'dart:async';
@@ -31,27 +32,27 @@
}
""";
-Future runTest1() {
- Uri uri = new Uri(scheme: 'source');
- var compiler = mockCompilerFor(TEST1, uri);
- return compiler.run(uri).then((_) {
- var typesInferrer = compiler.globalInference.typesInferrerInternal;
- var commonMasks = typesInferrer.closedWorld.commonMasks;
- MemberElement element = findElement(compiler, "foo");
- var mask = typesInferrer.getReturnTypeOfMember(element);
- var falseType =
- new ValueTypeMask(commonMasks.boolType, new FalseConstantValue());
- // 'foo' should always return false
- Expect.equals(falseType, mask);
- // the argument to 'bar' is always false
- dynamic bar = findElement(compiler, "bar");
- var barArg = bar.parameters.first;
- var barArgMask = typesInferrer.getTypeOfParameter(barArg);
- Expect.equals(falseType, barArgMask);
- var barCode = compiler.backend.getGeneratedCode(bar);
- Expect.isTrue(barCode.contains('"bbb"'));
- Expect.isFalse(barCode.contains('"aaa"'));
- });
+Future runTest1() async {
+ var result = await runCompiler(
+ memorySourceFiles: {'main.dart': TEST1},
+ options: ['--use-old-frontend', '--disable-inlining']);
+ var compiler = result.compiler;
+ var typesInferrer = compiler.globalInference.typesInferrerInternal;
+ var commonMasks = typesInferrer.closedWorld.commonMasks;
+ MemberElement element = findElement(compiler, "foo");
+ var mask = typesInferrer.getReturnTypeOfMember(element);
+ var falseType =
+ new ValueTypeMask(commonMasks.boolType, new FalseConstantValue());
+ // 'foo' should always return false
+ Expect.equals(falseType, mask);
+ // the argument to 'bar' is always false
+ dynamic bar = findElement(compiler, "bar");
+ var barArg = bar.parameters.first;
+ var barArgMask = typesInferrer.getTypeOfParameter(barArg);
+ Expect.equals(falseType, barArgMask);
+ var barCode = compiler.backend.getGeneratedCode(bar);
+ Expect.isTrue(barCode.contains('"bbb"'));
+ Expect.isFalse(barCode.contains('"aaa"'));
}
const String TEST2 = r"""
@@ -74,26 +75,26 @@
}
""";
-Future runTest2() {
- Uri uri = new Uri(scheme: 'source');
- var compiler = mockCompilerFor(TEST2, uri);
- return compiler.run(uri).then((_) {
- var typesInferrer = compiler.globalInference.typesInferrerInternal;
- var commonMasks = typesInferrer.closedWorld.commonMasks;
- MemberElement element = findElement(compiler, "foo");
- var mask = typesInferrer.getReturnTypeOfMember(element);
- // Can't infer value for foo's return type, it could be either true or false
- Expect.identical(commonMasks.boolType, mask);
- dynamic bar = findElement(compiler, "bar");
- var barArg = bar.parameters.first;
- var barArgMask = typesInferrer.getTypeOfParameter(barArg);
- // The argument to bar should have the same type as the return type of foo
- Expect.identical(commonMasks.boolType, barArgMask);
- var barCode = compiler.backend.getGeneratedCode(bar);
- Expect.isTrue(barCode.contains('"bbb"'));
- // Still must output the print for "aaa"
- Expect.isTrue(barCode.contains('"aaa"'));
- });
+Future runTest2() async {
+ var result = await runCompiler(
+ memorySourceFiles: {'main.dart': TEST2},
+ options: ['--use-old-frontend', '--disable-inlining']);
+ var compiler = result.compiler;
+ var typesInferrer = compiler.globalInference.typesInferrerInternal;
+ var commonMasks = typesInferrer.closedWorld.commonMasks;
+ MemberElement element = findElement(compiler, "foo");
+ var mask = typesInferrer.getReturnTypeOfMember(element);
+ // Can't infer value for foo's return type, it could be either true or false
+ Expect.identical(commonMasks.boolType, mask);
+ dynamic bar = findElement(compiler, "bar");
+ var barArg = bar.parameters.first;
+ var barArgMask = typesInferrer.getTypeOfParameter(barArg);
+ // The argument to bar should have the same type as the return type of foo
+ Expect.identical(commonMasks.boolType, barArgMask);
+ var barCode = compiler.backend.getGeneratedCode(bar);
+ Expect.isTrue(barCode.contains('"bbb"'));
+ // Still must output the print for "aaa"
+ Expect.isTrue(barCode.contains('"aaa"'));
}
main() {
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index dfd7721..c578e2c 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -34,22 +34,18 @@
export 'package:compiler/src/tree/tree.dart';
-import 'old_frontend/mock_compiler.dart';
-export 'old_frontend/mock_compiler.dart';
-
import 'memory_compiler.dart';
import 'output_collector.dart';
export 'output_collector.dart';
-enum CompileMode { mock, memory, kernel }
+enum CompileMode { memory, kernel }
-/// Compile [code] and returns either the code for [methodName] or, if [returnAll] is
-/// true, the code for the entire program.
+/// Compile [code] and returns either the code for [methodName] or, if
+/// [returnAll] is true, the code for the entire program.
///
/// If [check] is provided, it is executed on the code for [entry] before
-/// returning. If [useMock] is `true` the [MockCompiler] is used for
-/// compilation, otherwise the memory compiler is used.
+/// returning.
Future<String> compile(String code,
{String entry: 'main',
String methodName,
@@ -116,87 +112,37 @@
bool minify: false,
int expectedErrors,
int expectedWarnings,
- CompileMode compileMode: CompileMode.mock}) async {
+ CompileMode compileMode: CompileMode.memory}) async {
OutputCollector outputCollector = new OutputCollector();
- if (compileMode == CompileMode.mock) {
- Uri uri = new Uri(scheme: 'source');
- MockCompiler compiler = mockCompilerFor(code, uri,
- coreSource: coreSource,
- disableInlining: disableInlining,
- minify: minify,
- expectedErrors: expectedErrors,
- trustTypeAnnotations: trustTypeAnnotations,
- expectedWarnings: expectedWarnings,
- outputProvider: outputCollector);
- compiler.diagnosticHandler = createHandler(compiler, code);
- bool compilationSucceeded = await compiler.run(uri);
- Expect.isTrue(
- compilationSucceeded,
- 'Unexpected compilation error(s): '
- '${compiler.diagnosticCollector.errors}');
- } else {
- DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
- if (coreSource != null) {
- throw new UnsupportedError(
- 'coreSource is not supported for $compileMode');
- }
- List<String> options = <String>[];
- if (disableInlining) {
- options.add(Flags.disableInlining);
- }
- if (trustTypeAnnotations) {
- options.add(Flags.trustTypeAnnotations);
- }
- if (minify) {
- options.add(Flags.minify);
- }
- if (compileMode == CompileMode.kernel) {
- options.add(Flags.useKernel);
- }
- CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code},
- options: options,
- outputProvider: outputCollector,
- diagnosticHandler: diagnosticCollector);
- Expect.isTrue(
- result.isSuccess,
- 'Unexpected compilation error(s): '
- '${diagnosticCollector.errors}');
+ DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
+ if (coreSource != null) {
+ throw new UnsupportedError('coreSource is not supported for $compileMode');
}
+ List<String> options = <String>[];
+ if (disableInlining) {
+ options.add(Flags.disableInlining);
+ }
+ if (trustTypeAnnotations) {
+ options.add(Flags.trustTypeAnnotations);
+ }
+ if (minify) {
+ options.add(Flags.minify);
+ }
+ if (compileMode == CompileMode.kernel) {
+ options.add(Flags.useKernel);
+ }
+ CompilationResult result = await runCompiler(
+ memorySourceFiles: {'main.dart': code},
+ options: options,
+ outputProvider: outputCollector,
+ diagnosticHandler: diagnosticCollector);
+ Expect.isTrue(
+ result.isSuccess,
+ 'Unexpected compilation error(s): '
+ '${diagnosticCollector.errors}');
return outputCollector.getOutput('', OutputType.js);
}
-Future analyzeAndCheck(
- String code, String name, check(MockCompiler compiler, Element element),
- {int expectedErrors, int expectedWarnings}) {
- Uri uri = new Uri(scheme: 'source');
- MockCompiler compiler = mockCompilerFor(code, uri,
- expectedErrors: expectedErrors,
- expectedWarnings: expectedWarnings,
- analyzeOnly: true);
- return compiler.run(uri).then((_) {
- Element element = findElement(compiler, name);
- return check(compiler, element);
- });
-}
-
-Future compileSources(
- Map<String, String> sources, check(MockCompiler compiler)) {
- Uri base = new Uri(scheme: 'source', path: '/');
- Uri mainUri = base.resolve('main.dart');
- String mainCode = sources['main.dart'];
- Expect.isNotNull(mainCode, 'No source code found for "main.dart"');
- MockCompiler compiler = mockCompilerFor(mainCode, mainUri);
- sources.forEach((String path, String code) {
- if (path == 'main.dart') return;
- compiler.registerSource(base.resolve(path), code);
- });
-
- return compiler.run(mainUri).then((_) {
- return check(compiler);
- });
-}
-
Element findElement(compiler, String name, [Uri library]) {
LibraryElement lib = compiler.frontendStrategy.elementEnvironment.mainLibrary;
if (library != null) {
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index 66b9211..ed2eb24 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -1,14 +1,17 @@
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
+
analyze_dart_test: Slow, Pass
analyze_test: Slow, Pass
async_await_syntax_test: Pass # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
boolified_operator_test: Fail # Issue 8001
closure/closure_test: Pass, Slow
codegen/gvn_dynamic_field_get_test: Fail # Issue 18519
+codegen/list_tracer_length_test: Fail # Issue 33051
codegen/load_elimination_test: Pass, Slow
codegen/logical_expression_test: Fail # Issue 17027
+codegen/side_effect_tdiv_regression_test: Fail # Issue 33050
codegen/simple_function_subtype_test: Fail # simple_function_subtype_test is temporarily(?) disabled due to new method for building function type tests.
deferred_loading/deferred_loading_test: Slow, Pass
equivalence/id_equivalence1_test: Pass, Slow
diff --git a/tests/compiler/dart2js/old_frontend/mock_compiler.dart b/tests/compiler/dart2js/old_frontend/mock_compiler.dart
deleted file mode 100644
index 2bb5bee..0000000
--- a/tests/compiler/dart2js/old_frontend/mock_compiler.dart
+++ /dev/null
@@ -1,401 +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 mock_compiler;
-
-import 'dart:async';
-import 'dart:collection';
-
-import 'package:compiler/compiler_new.dart' as api;
-import 'package:compiler/src/common/names.dart' show Uris;
-import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/elements/resolution_types.dart'
- show ResolutionDartType;
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/diagnostics/source_span.dart';
-import 'package:compiler/src/diagnostics/spannable.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/visitor.dart';
-import 'package:compiler/src/library_loader.dart' show LoadedLibraries;
-import 'package:compiler/src/io/source_file.dart';
-import 'package:compiler/src/options.dart' show CompilerOptions;
-import 'package:compiler/src/resolution/members.dart';
-import 'package:compiler/src/resolution/registry.dart';
-import 'package:compiler/src/resolution/scope.dart';
-import 'package:compiler/src/resolution/tree_elements.dart';
-import 'package:compiler/src/resolved_uri_translator.dart';
-import 'package:compiler/src/script.dart';
-import 'package:compiler/src/tree/tree.dart';
-import 'package:compiler/src/old_to_new_api.dart';
-import 'parser_helper.dart';
-
-import 'package:compiler/src/elements/modelx.dart'
- show ErroneousElementX, FunctionElementX;
-
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/common/tasks.dart' show Measurer;
-
-import 'package:compiler/src/deferred_load.dart' show OutputUnit;
-
-import 'package:compiler/src/resolution/deferred_load.dart'
- show AstDeferredLoadTask;
-
-import 'mock_libraries.dart';
-import '../diagnostic_helper.dart';
-
-export '../diagnostic_helper.dart';
-
-final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core');
-
-typedef String LibrarySourceProvider(Uri uri);
-
-class MockCompiler extends Compiler {
- api.CompilerDiagnostics diagnosticHandler;
- final api.CompilerInput provider = null;
-
- /// Expected number of warnings. If `null`, the number of warnings is
- /// not checked.
- final int expectedWarnings;
-
- /// Expected number of errors. If `null`, the number of errors is not checked.
- final int expectedErrors;
- final Map<String, SourceFile> sourceFiles;
- Node parsedTree;
- final LibrarySourceProvider librariesOverride;
- final DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
- final ResolvedUriTranslator resolvedUriTranslator =
- new MockResolvedUriTranslator();
- final Measurer measurer = new Measurer();
- LibraryElement mainApp;
-
- MockCompiler.internal(
- {Map<String, String> coreSource,
- bool enableTypeAssertions: false,
- bool enableUserAssertions: false,
- bool enableMinification: false,
- bool disableTypeInference: false,
- bool analyzeAll: false,
- bool analyzeOnly: false,
- // Our unit tests check code generation output that is
- // affected by inlining support.
- bool disableInlining: true,
- bool trustTypeAnnotations: false,
- bool trustJSInteropTypeAnnotations: false,
- bool enableAsyncAwait: false,
- int this.expectedWarnings,
- int this.expectedErrors,
- api.CompilerOutput outputProvider,
- LibrarySourceProvider this.librariesOverride})
- : sourceFiles = new Map<String, SourceFile>(),
- super(
- options: new CompilerOptions()
- ..entryPoint = new Uri(scheme: 'mock')
- ..libraryRoot = Uri.parse('placeholder_library_root_for_mock/')
- ..useKernel = false
- ..enableTypeAssertions = enableTypeAssertions
- ..enableUserAssertions = enableUserAssertions
- ..disableInlining = disableInlining
- ..enableAssertMessage = true
- ..enableMinification = enableMinification
- ..disableTypeInference = disableTypeInference
- ..analyzeAll = analyzeAll
- ..analyzeOnly = analyzeOnly
- ..trustTypeAnnotations = trustTypeAnnotations
- ..trustJSInteropTypeAnnotations = trustJSInteropTypeAnnotations
- ..shownPackageWarnings = const [],
- outputProvider: outputProvider) {
- deferredLoadTask = new MockDeferredLoadTask(this);
-
- registerSource(
- Uris.dart_core, buildLibrarySource(DEFAULT_CORE_LIBRARY, coreSource));
- registerSource(PATCH_CORE, DEFAULT_PATCH_CORE_SOURCE);
- registerSource(
- Uris.dart__internal, buildLibrarySource(DEFAULT_INTERNAL_LIBRARY));
-
- registerSource(
- Uris.dart__js_helper, buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY));
- registerSource(Uris.dart__foreign_helper,
- buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY));
- registerSource(Uris.dart__interceptors,
- buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY));
- registerSource(Uris.dart__isolate_helper,
- buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY));
- registerSource(Uris.dart_mirrors, DEFAULT_MIRRORS_SOURCE);
- registerSource(Uris.dart__js_mirrors, DEFAULT_JS_MIRRORS_SOURCE);
-
- Map<String, String> asyncLibrarySource = <String, String>{};
- asyncLibrarySource.addAll(DEFAULT_ASYNC_LIBRARY);
- if (enableAsyncAwait) {
- asyncLibrarySource.addAll(ASYNC_AWAIT_LIBRARY);
- }
- registerSource(Uris.dart_async, buildLibrarySource(asyncLibrarySource));
- }
-
- /// Initialize the mock compiler with an empty main library.
- Future<Uri> init([String mainSource = ""]) {
- Uri uri = new Uri(scheme: "mock");
- registerSource(uri, mainSource);
- return libraryLoader
- .loadLibrary(uri)
- .then((LoadedLibraries loadedLibraries) {
- processLoadedLibraries(loadedLibraries);
- mainApp = loadedLibraries.rootLibrary;
- startResolution();
- // We need to make sure the Object class is resolved. When registering a
- // dynamic invocation the ArgumentTypesRegistry eventually iterates over
- // the interfaces of the Object class which would be 'null' if the class
- // wasn't resolved.
- ClassElement objectClass = resolution.commonElements.objectClass;
- objectClass.ensureResolved(resolution);
- }).then((_) => uri);
- }
-
- Future<bool> run(Uri uri, [String mainSource = ""]) {
- return init(mainSource).then((Uri mainUri) {
- return super.run(uri == null ? mainUri : uri);
- }).then((result) {
- if (expectedErrors != null &&
- expectedErrors != diagnosticCollector.errors.length) {
- throw "unexpected error during compilation "
- "${diagnosticCollector.errors}";
- } else if (expectedWarnings != null &&
- expectedWarnings != diagnosticCollector.warnings.length) {
- throw "unexpected warnings during compilation "
- "${diagnosticCollector.warnings}";
- } else {
- return result;
- }
- });
- }
-
- /**
- * Registers the [source] with [uri] making it possible load [source] as a
- * library. If an override has been provided in [librariesOverride], that
- * is used instead.
- */
- void registerSource(Uri uri, String source) {
- if (librariesOverride != null) {
- String override = librariesOverride(uri);
- if (override != null) {
- source = override;
- }
- }
- sourceFiles[uri.toString()] = new MockFile(source);
- }
-
- void reportDiagnostic(DiagnosticMessage message,
- List<DiagnosticMessage> infoMessages, api.Diagnostic kind) {
- void processMessage(DiagnosticMessage message, api.Diagnostic kind) {
- SourceSpan span = message.sourceSpan;
- Uri uri;
- int begin;
- int end;
- String text = '${message.message}';
- if (span != null) {
- uri = span.uri;
- begin = span.begin;
- end = span.end;
- }
- diagnosticCollector.report(message.message, uri, begin, end, text, kind);
- if (diagnosticHandler != null) {
- diagnosticHandler.report(message.message, uri, begin, end, text, kind);
- }
- }
-
- processMessage(message, kind);
- infoMessages.forEach((i) => processMessage(i, api.Diagnostic.INFO));
- }
-
- CollectingTreeElements resolveStatement(String text) {
- parsedTree = parseStatement(text);
- LibraryElement library = mainApp;
- return resolveNodeStatement(parsedTree, new MockElement(library));
- }
-
- TreeElementMapping resolveNodeStatement(
- Node tree, ExecutableElement element) {
- ResolverVisitor visitor = new ResolverVisitor(
- this.resolution,
- element,
- new ResolutionRegistry(
- this.backend.target, new CollectingTreeElements(element)),
- scope:
- new MockTypeVariablesScope(element.enclosingElement.buildScope()));
- if (visitor.scope is LibraryScope ||
- visitor.scope is MockTypeVariablesScope) {
- visitor.scope = new MethodScope(visitor.scope, element);
- }
- visitor.visit(tree);
- visitor.scope = new LibraryScope(element.library);
- return visitor.registry.mapping;
- }
-
- resolverVisitor() {
- LibraryElement library = mainApp;
- Element mockElement = new MockElement(library.entryCompilationUnit);
- ResolverVisitor visitor = new ResolverVisitor(
- this.resolution,
- mockElement,
- new ResolutionRegistry(
- this.backend.target, new CollectingTreeElements(mockElement)),
- scope: mockElement.enclosingElement.buildScope());
- visitor.scope = new MethodScope(visitor.scope, mockElement);
- return visitor;
- }
-
- parseScript(String text, [LibraryElement library]) {
- if (library == null) library = mainApp;
- parseUnit(text, this, library, registerSource);
- }
-
- Future scanBuiltinLibraries() {
- // Do nothing. The mock core library is already handled in the constructor.
- return new Future.value();
- }
-
- Future<LibraryElement> scanBuiltinLibrary(String name) {
- // Do nothing. The mock core library is already handled in the constructor.
- return new Future.value();
- }
-
- // The mock library doesn't need any patches.
- Uri resolvePatchUri(String dartLibraryName) {
- if (dartLibraryName == 'core') {
- return PATCH_CORE;
- }
- return null;
- }
-
- Future<Script> readScript(Uri uri, [Spannable spannable]) {
- SourceFile sourceFile = sourceFiles[uri.toString()];
- if (sourceFile == null) throw new ArgumentError(uri);
- return new Future.value(new Script(uri, uri, sourceFile));
- }
-
- Element lookupElementIn(ScopeContainerElement container, name) {
- Element element = container.localLookup(name);
- return element != null
- ? element
- : new ErroneousElementX(null, null, name, container);
- }
-
- /// Create a new [MockCompiler] and apply it asynchronously to [f].
- static Future<T> create<T>(FutureOr<T> f(MockCompiler compiler)) {
- MockCompiler compiler = new MockCompiler.internal();
- return compiler.init().then((_) => f(compiler));
- }
-}
-
-class MockResolvedUriTranslator implements ResolvedUriTranslator {
- static final dynamic _emptySet = new Set();
-
- Uri translate(LibraryElement importingLibrary, Uri resolvedUri,
- Spannable spannable) =>
- resolvedUri;
- Set<Uri> get disallowedLibraryUris => _emptySet;
- bool get mockableLibraryUsed => false;
- Map<String, Uri> get sdkLibraries => const <String, Uri>{};
-}
-
-class CollectingTreeElements extends TreeElementMapping {
- final Map<Node, Element> map = new LinkedHashMap<Node, Element>();
-
- CollectingTreeElements(Element currentElement) : super(currentElement);
-
- operator []=(Node node, Element element) {
- map[node] = element;
- }
-
- operator [](Node node) => map[node];
-
- void remove(Node node) {
- map.remove(node);
- }
-
- List<ConstantExpression> get constants {
- List<ConstantExpression> list = <ConstantExpression>[];
- forEachConstantNode((_, c) => list.add(c));
- return list;
- }
-}
-
-class MockTypeVariablesScope extends TypeVariablesScope {
- @override
- List<ResolutionDartType> get typeVariables => <ResolutionDartType>[];
- MockTypeVariablesScope(Scope parent) : super(parent);
- String toString() => 'MockTypeVariablesScope($parent)';
-}
-
-// The mock compiler does not split the program in output units.
-class MockDeferredLoadTask extends AstDeferredLoadTask {
- MockDeferredLoadTask(Compiler compiler) : super(compiler);
-
- OutputUnit getElementOutputUnit(dynamic dependency) {
- return mainOutputUnit;
- }
-}
-
-api.CompilerDiagnostics createHandler(MockCompiler compiler, String text,
- {bool verbose: false}) {
- return new LegacyCompilerDiagnostics(
- (uri, int begin, int end, String message, kind) {
- if (kind == api.Diagnostic.VERBOSE_INFO && !verbose) return;
- SourceFile sourceFile;
- if (uri == null) {
- sourceFile = new StringSourceFile.fromName('analysis', text);
- } else {
- sourceFile = compiler.sourceFiles[uri.toString()];
- }
- if (sourceFile != null && begin != null && end != null) {
- print('${kind}: ${sourceFile.getLocationMessage(message, begin, end)}');
- } else {
- print('${kind}: $message');
- }
- });
-}
-
-class MockElement extends FunctionElementX {
- MockElement(Element enclosingElement)
- : super('', ElementKind.FUNCTION, Modifiers.EMPTY, enclosingElement);
-
- get node => null;
-
- parseNode(_) => null;
-
- bool get hasNode => false;
-
- accept(ElementVisitor visitor, arg) {
- return visitor.visitMethodElement(this, arg);
- }
-}
-
-// TODO(herhut): Disallow warnings and errors during compilation by default.
-MockCompiler mockCompilerFor(String code, Uri uri,
- {bool analyzeAll: false,
- bool analyzeOnly: false,
- Map<String, String> coreSource,
- bool disableInlining: true,
- bool minify: false,
- bool trustTypeAnnotations: false,
- bool enableTypeAssertions: false,
- bool enableUserAssertions: false,
- int expectedErrors,
- int expectedWarnings,
- api.CompilerOutput outputProvider}) {
- MockCompiler compiler = new MockCompiler.internal(
- analyzeAll: analyzeAll,
- analyzeOnly: analyzeOnly,
- coreSource: coreSource,
- disableInlining: disableInlining,
- enableMinification: minify,
- trustTypeAnnotations: trustTypeAnnotations,
- enableTypeAssertions: enableTypeAssertions,
- enableUserAssertions: enableUserAssertions,
- expectedErrors: expectedErrors,
- expectedWarnings: expectedWarnings,
- outputProvider: outputProvider);
- compiler.registerSource(uri, code);
- compiler.diagnosticHandler = createHandler(compiler, code);
- return compiler;
-}
diff --git a/tests/compiler/dart2js/old_frontend/options_helper.dart b/tests/compiler/dart2js/old_frontend/options_helper.dart
deleted file mode 100644
index ec63774..0000000
--- a/tests/compiler/dart2js/old_frontend/options_helper.dart
+++ /dev/null
@@ -1,20 +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 options_helper;
-
-import 'package:compiler/src/options.dart';
-export 'package:compiler/src/options.dart';
-
-class MockDiagnosticOptions implements DiagnosticOptions {
- const MockDiagnosticOptions();
-
- bool get fatalWarnings => false;
- bool get terseDiagnostics => false;
- bool get suppressWarnings => false;
- bool get suppressHints => false;
- bool get showAllPackageWarnings => false;
- bool get hidePackageWarnings => true;
- bool showPackageWarningsFor(Uri uri) => false;
-}
diff --git a/tests/compiler/dart2js/old_frontend/parser_helper.dart b/tests/compiler/dart2js/old_frontend/parser_helper.dart
deleted file mode 100644
index 55a4f34..0000000
--- a/tests/compiler/dart2js/old_frontend/parser_helper.dart
+++ /dev/null
@@ -1,165 +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 parser_helper;
-
-import 'package:expect/expect.dart';
-
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/id_generator.dart';
-import 'package:compiler/src/tree/tree.dart';
-import 'package:compiler/src/parser/element_listener.dart';
-import 'package:compiler/src/parser/node_listener.dart';
-import 'package:compiler/src/parser/diet_parser_task.dart';
-import 'package:front_end/src/fasta/parser.dart' hide parse;
-import 'package:front_end/src/fasta/scanner.dart' hide scan;
-import 'package:compiler/src/io/source_file.dart';
-import 'package:compiler/src/util/util.dart';
-
-import 'package:compiler/src/elements/modelx.dart'
- show CompilationUnitElementX, ElementX, LibraryElementX;
-
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/options.dart';
-import 'package:compiler/src/diagnostics/source_span.dart';
-import 'package:compiler/src/diagnostics/spannable.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/diagnostics/messages.dart';
-import 'package:compiler/src/script.dart';
-
-import 'options_helper.dart';
-
-export 'package:front_end/src/fasta/parser.dart' hide parse;
-export 'package:front_end/src/fasta/scanner.dart' hide scan;
-export 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-export 'package:compiler/src/parser/node_listener.dart';
-export 'package:compiler/src/parser/diet_parser_task.dart';
-export 'package:front_end/src/fasta/scanner/token_constants.dart';
-
-import 'mock_compiler.dart';
-
-class LoggerCanceler extends DiagnosticReporter {
- DiagnosticOptions get options => const MockDiagnosticOptions();
-
- void log(message) {
- print(message);
- }
-
- void internalError(Spannable node, message) {
- log(message);
- }
-
- SourceSpan spanFromSpannable(node) {
- throw 'unsupported operation';
- }
-
- SourceSpan spanFromToken(token) => null;
-
- void reportError(DiagnosticMessage message,
- [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
- log(message);
- infos.forEach(log);
- }
-
- void reportWarning(DiagnosticMessage message,
- [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
- log(message);
- infos.forEach(log);
- }
-
- void reportInfo(Spannable node, MessageKind errorCode,
- [Map arguments = const {}]) {
- log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
- }
-
- void reportHint(DiagnosticMessage message,
- [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
- log(message);
- infos.forEach(log);
- }
-
- withCurrentElement(Entity element, f()) => f();
-
- @override
- DiagnosticMessage createMessage(Spannable spannable, MessageKind messageKind,
- [Map arguments = const {}]) {
- return new DiagnosticMessage(null, spannable,
- new Message(MessageTemplate.TEMPLATES[messageKind], arguments, false));
- }
-
- @override
- bool get hasReportedError => false;
-}
-
-Token scan(String text) => new StringScanner(text).tokenize();
-
-Node parseBodyCode(String text, Function parseMethod,
- {DiagnosticReporter reporter}) {
- Token tokens = scan(text);
- if (reporter == null) reporter = new LoggerCanceler();
- Uri uri = new Uri(scheme: "source");
- Script script = new Script(uri, uri, new MockFile(text));
- LibraryElement library = new LibraryElementX(script);
- NodeListener listener = new NodeListener(
- new ScannerOptions(canUseNative: true),
- reporter,
- library.entryCompilationUnit);
- Parser parser = new Parser(listener);
- Token endToken = parseMethod(parser, tokens).next;
- assert(endToken.kind == EOF_TOKEN);
- Node node = listener.popNode();
- Expect.isNotNull(node);
- Expect.isTrue(listener.nodes.isEmpty, 'Not empty: ${listener.nodes}');
- return node;
-}
-
-Node parseStatement(String text) => parseBodyCode(
- text,
- (parser, tokens) =>
- parser.parseStatement(parser.syntheticPreviousToken(tokens)));
-
-Node parseFunction(String text, MockCompiler compiler) {
- ElementX element = parseUnit(text, compiler, compiler.mainApp).head;
- Expect.isNotNull(element);
- Expect.equals(ElementKind.FUNCTION, element.kind);
- return element.parseNode(compiler.parsingContext);
-}
-
-Node parseMember(String text, {DiagnosticReporter reporter}) {
- return parseBodyCode(
- text, (parser, tokens) => parser.parseClassMember(tokens),
- reporter: reporter);
-}
-
-class MockFile extends StringSourceFile {
- MockFile(text) : super.fromName('<string>', text);
-}
-
-var sourceCounter = 0;
-
-Link<Element> parseUnit(String text, Compiler compiler, LibraryElement library,
- [void registerSource(Uri uri, String source)]) {
- Token tokens = scan(text);
- Uri uri = new Uri(scheme: "source", path: '${++sourceCounter}');
- if (registerSource != null) {
- registerSource(uri, text);
- }
- var script = new Script(uri, uri, new MockFile(text));
- var unit = new CompilationUnitElementX(script, library);
- DiagnosticReporter reporter = compiler.reporter;
- ElementListener listener = new ElementListener(
- compiler.parsingContext.getScannerOptionsFor(library),
- reporter,
- unit,
- new IdGenerator());
- PartialParser parser = new PartialParser(listener);
- reporter.withCurrentElement(unit, () => parser.parseUnit(tokens));
- return unit.localMembers;
-}
-
-NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) {
- return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
- reporter: reporter);
-}
diff --git a/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart b/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart
deleted file mode 100644
index bd74cbe..0000000
--- a/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'package:expect/expect.dart';
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/io/code_output.dart';
-import 'package:compiler/src/io/source_file.dart';
-import 'package:compiler/src/io/source_information.dart';
-import 'package:compiler/src/js_backend/js_backend.dart';
-import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full
- show Emitter;
-
-import '../old_frontend/mock_compiler.dart';
-
-Future<CodeOutput> compileAll(SourceFile sourceFile) {
- MockCompiler compiler = new MockCompiler.internal();
- Uri uri = new Uri(path: sourceFile.filename);
- compiler.sourceFiles[uri.toString()] = sourceFile;
- JavaScriptBackend backend = compiler.backend;
- return compiler.run(uri).then((_) {
- // TODO(floitsch): the outputBuffers are only accessible in the full
- // emitter.
- full.Emitter fullEmitter = backend.emitter.emitter;
- return fullEmitter
- .outputBuffers[compiler.backend.outputUnitData.mainOutputUnit];
- });
-}
-
-void testSourceMapLocations(String codeWithMarkers) {
- List<int> expectedLocations = new List<int>();
- for (int i = 0; i < codeWithMarkers.length; ++i) {
- if (codeWithMarkers[i] == '@') {
- expectedLocations.add(i - expectedLocations.length);
- }
- }
- String code = codeWithMarkers.replaceAll('@', '');
-
- SourceFile sourceFile = new StringSourceFile.fromName('<test script>', code);
- asyncTest(() => compileAll(sourceFile).then((CodeOutput output) {
- Set<int> locations = new Set<int>();
- SourceLocations sourceLocations = output.sourceLocations.single;
- sourceLocations
- .forEachSourceLocation((int offset, SourceLocation sourcePosition) {
- if (sourcePosition != null &&
- sourcePosition.sourceUri == sourceFile.uri) {
- locations.add(sourcePosition.offset);
- }
- });
-
- for (int i = 0; i < expectedLocations.length; ++i) {
- int expectedLocation = expectedLocations[i];
- if (!locations.contains(expectedLocation)) {
- int originalLocation = expectedLocation + i;
- SourceFile sourceFileWithMarkers =
- new StringSourceFile.fromName('<test script>', codeWithMarkers);
- String message = sourceFileWithMarkers.getLocationMessage(
- 'Missing location', originalLocation, originalLocation + 1);
- Expect.fail(message);
- }
- }
- }));
-}
-
-String FUNCTIONS_TEST = '''
-@void main() { print(test(15)); @}
-// The 'if' has been added to avoid inlining of 'test'.
-@int test(int x) { if (x != null) return x; else return null; @}''';
-
-String RETURN_TEST = 'void main() { print(((x) { @return x; })(0)); }';
-
-String NOT_TEST = 'void main() { ((x) { if (@!x) print(x); })(1==2); }';
-
-String UNARY_TEST = 'void main() { ((x, y) { print(@-x + @~y); })(1,2); }';
-
-String BINARY_TEST =
- 'void main() { ((x, y) { if (x @!= y) print(x @* y); })(1,2); }';
-
-String SEND_TEST = '''
-void main() {
- @staticSend(0);
- NewSend o = @new NewSend();
- @o.dynamicSend(0);
- var closureSend = (x) { print(x); };
- @closureSend(0);
-}
-// The 'if' has been added to avoid inlining of 'staticSend'.
-void staticSend(x) { if (x == null) return; print(x); }
-class NewSend { void dynamicSend(x) { print(x); } }
-''';
-
-String SEND_SET_TEST = '''
-String global;
-void main() { @global = ''; print(new A().foo()); }
-class A { int x; foo() { @x = 3; } }''';
-
-String LOOP_TEST = '''
-void main() {
- @for (int i = 0; i < 100; ++i) { print(test(13)); @}
-}
-int test(int x) {
- int result = 1; @while (result < x) { result <<= 1; @} return result;
-}''';
-
-String INTERCEPTOR_TEST = '''void main() { var l = []; @l.add(0); print(l); }
-''';
-
-main() {
- // These tests are fragile, since mappings for specific source locations
- // could disappear due to various optimizations like code elimination,
- // function inlining, etc. If you broke the test, please try to rewrite it
- // so that the new code is not optimized, otherwise just remove the marker
- // from problematic location.
- testSourceMapLocations(FUNCTIONS_TEST);
- testSourceMapLocations(RETURN_TEST);
- testSourceMapLocations(NOT_TEST);
- testSourceMapLocations(UNARY_TEST);
- testSourceMapLocations(BINARY_TEST);
- testSourceMapLocations(SEND_TEST);
- testSourceMapLocations(SEND_SET_TEST);
- testSourceMapLocations(LOOP_TEST);
- testSourceMapLocations(INTERCEPTOR_TEST);
-}
diff --git a/tests/compiler/dart2js_extra/dummy_compiler_test.dart b/tests/compiler/dart2js_extra/dummy_compiler_test.dart
index 09c60e4..3e3a64f 100644
--- a/tests/compiler/dart2js_extra/dummy_compiler_test.dart
+++ b/tests/compiler/dart2js_extra/dummy_compiler_test.dart
@@ -11,7 +11,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler.dart';
-import '../dart2js/old_frontend/mock_libraries.dart';
+import 'mock_libraries.dart';
String libProvider(Uri uri) {
if (uri.path.endsWith(".platform")) {
diff --git a/tests/compiler/dart2js/old_frontend/mock_libraries.dart b/tests/compiler/dart2js_extra/mock_libraries.dart
similarity index 100%
rename from tests/compiler/dart2js/old_frontend/mock_libraries.dart
rename to tests/compiler/dart2js_extra/mock_libraries.dart