| Index: pkg/compiler/lib/src/compiler.dart
|
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
|
| index b371ba6b3cc75c4fb83f9b66551e66e66b751141..9477e8af6519711891332db098aa200b58fef218 100644
|
| --- a/pkg/compiler/lib/src/compiler.dart
|
| +++ b/pkg/compiler/lib/src/compiler.dart
|
| @@ -79,13 +79,18 @@ import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact;
|
| import 'util/util.dart' show Link, Setlet;
|
| import 'world.dart' show World;
|
|
|
| +typedef Backend MakeBackendFuncion(Compiler compiler);
|
| +
|
| +typedef CompilerDiagnosticReporter MakeReporterFunction(
|
| + Compiler compiler, CompilerOptions options);
|
| +
|
| abstract class Compiler implements LibraryLoaderListener {
|
| final Stopwatch totalCompileTime = new Stopwatch();
|
| final IdGenerator idGenerator = new IdGenerator();
|
| World world;
|
| Types types;
|
| _CompilerCoreTypes _coreTypes;
|
| - _CompilerDiagnosticReporter _reporter;
|
| + CompilerDiagnosticReporter _reporter;
|
| _CompilerResolution _resolution;
|
| ParsingContext _parsingContext;
|
|
|
| @@ -281,17 +286,23 @@ abstract class Compiler implements LibraryLoaderListener {
|
| Compiler(
|
| {CompilerOptions options,
|
| api.CompilerOutput outputProvider,
|
| - this.environment: const _EmptyEnvironment()})
|
| + this.environment: const _EmptyEnvironment(),
|
| + MakeBackendFuncion makeBackend,
|
| + MakeReporterFunction makeReporter})
|
| : this.options = options,
|
| this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport),
|
| this.userOutputProvider = outputProvider == null
|
| ? const NullCompilerOutput()
|
| : outputProvider {
|
| world = new World(this);
|
| + if (makeReporter != null) {
|
| + _reporter = makeReporter(this, options);
|
| + } else {
|
| + _reporter = new CompilerDiagnosticReporter(this, options);
|
| + }
|
| + _resolution = new _CompilerResolution(this);
|
| // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and
|
| // make its field final.
|
| - _reporter = new _CompilerDiagnosticReporter(this, options);
|
| - _resolution = new _CompilerResolution(this);
|
| _coreTypes = new _CompilerCoreTypes(_resolution);
|
| types = new Types(_resolution);
|
| tracer = new Tracer(this, this.outputProvider);
|
| @@ -304,7 +315,9 @@ abstract class Compiler implements LibraryLoaderListener {
|
| // for global dependencies.
|
| globalDependencies = new GlobalDependencyRegistry(this);
|
|
|
| - if (options.emitJavaScript) {
|
| + if (makeBackend != null) {
|
| + backend = makeBackend(this);
|
| + } else if (options.emitJavaScript) {
|
| js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend(
|
| this,
|
| generateSourceMap: options.generateSourceMap,
|
| @@ -346,7 +359,7 @@ abstract class Compiler implements LibraryLoaderListener {
|
| constants = backend.constantCompilerTask,
|
| deferredLoadTask = new DeferredLoadTask(this),
|
| mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
|
| - enqueuer = new EnqueueTask(this),
|
| + enqueuer = backend.makeEnqueuer(),
|
| dumpInfoTask = new DumpInfoTask(this),
|
| reuseLibraryTask = new GenericTask('Reuse library', this),
|
| ];
|
| @@ -1391,7 +1404,7 @@ class _CompilerCoreTypes implements CoreTypes, CoreClasses {
|
| }
|
| }
|
|
|
| -class _CompilerDiagnosticReporter extends DiagnosticReporter {
|
| +class CompilerDiagnosticReporter extends DiagnosticReporter {
|
| final Compiler compiler;
|
| final DiagnosticOptions options;
|
|
|
| @@ -1406,7 +1419,7 @@ class _CompilerDiagnosticReporter extends DiagnosticReporter {
|
| /// suppressed for each library.
|
| Map<Uri, SuppressionInfo> suppressedWarnings = <Uri, SuppressionInfo>{};
|
|
|
| - _CompilerDiagnosticReporter(this.compiler, this.options);
|
| + CompilerDiagnosticReporter(this.compiler, this.options);
|
|
|
| Element get currentElement => _currentElement;
|
|
|
|
|