| Index: tests/compiler/dart2js/mock_compiler.dart
|
| diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
|
| index af82c4aebc8974072e6e1c1275bf372758b0b79d..ffa014fa32108c9bb773f60af16ebf4f286ca560 100644
|
| --- a/tests/compiler/dart2js/mock_compiler.dart
|
| +++ b/tests/compiler/dart2js/mock_compiler.dart
|
| @@ -263,24 +263,25 @@ class MockCompiler extends Compiler {
|
| final Map<String, SourceFile> sourceFiles;
|
| Node parsedTree;
|
|
|
| - MockCompiler({String coreSource: DEFAULT_CORELIB,
|
| - String helperSource: DEFAULT_HELPERLIB,
|
| - String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
|
| - String isolateHelperSource: DEFAULT_ISOLATE_HELPERLIB,
|
| - bool enableTypeAssertions: false,
|
| - bool enableMinification: false,
|
| - bool enableConcreteTypeInference: false,
|
| - int maxConcreteTypeSize: 5,
|
| - bool disableTypeInference: false,
|
| - bool analyzeAll: false,
|
| - bool analyzeOnly: false,
|
| - bool emitJavaScript: true,
|
| - bool preserveComments: false,
|
| - // Our unit tests check code generation output that is
|
| - // affected by inlining support.
|
| - bool disableInlining: true,
|
| - int this.expectedWarnings,
|
| - int this.expectedErrors})
|
| + MockCompiler.internal(
|
| + {String coreSource: DEFAULT_CORELIB,
|
| + String helperSource: DEFAULT_HELPERLIB,
|
| + String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
|
| + String isolateHelperSource: DEFAULT_ISOLATE_HELPERLIB,
|
| + bool enableTypeAssertions: false,
|
| + bool enableMinification: false,
|
| + bool enableConcreteTypeInference: false,
|
| + int maxConcreteTypeSize: 5,
|
| + bool disableTypeInference: false,
|
| + bool analyzeAll: false,
|
| + bool analyzeOnly: false,
|
| + bool emitJavaScript: true,
|
| + bool preserveComments: false,
|
| + // Our unit tests check code generation output that is
|
| + // affected by inlining support.
|
| + bool disableInlining: true,
|
| + int this.expectedWarnings,
|
| + int this.expectedErrors})
|
| : sourceFiles = new Map<String, SourceFile>(),
|
| super(enableTypeAssertions: enableTypeAssertions,
|
| enableMinification: enableMinification,
|
| @@ -325,6 +326,12 @@ class MockCompiler extends Compiler {
|
| deferredLoadTask = new MockDeferredLoadTask(this);
|
| }
|
|
|
| + /// Initialize the mock compiler with an empty main library.
|
| + Future init() {
|
| + // Stub for initialization.
|
| + return new Future.value();
|
| + }
|
| +
|
| Future runCompiler(Uri uri) {
|
| return super.runCompiler(uri).then((result) {
|
| if (expectedErrors != null &&
|
| @@ -474,6 +481,12 @@ class MockCompiler extends Compiler {
|
| ? element
|
| : new ErroneousElementX(null, null, name, container);
|
| }
|
| +
|
| + /// Create a new [MockCompiler] and apply it asynchronously to [f].
|
| + static Future create(f(MockCompiler compiler)) {
|
| + MockCompiler compiler = new MockCompiler.internal();
|
| + return compiler.init().then((_) => f(compiler));
|
| + }
|
| }
|
|
|
| /// A function the checks [message]. If the check fails or if [message] is
|
|
|