Index: pkg/compiler/lib/src/compiler.dart |
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
index a05bcc787bf33a19116350b43ed642eae33ea25e..4c815e611d16a7b478492df17ea2ec18a81b2a6e 100644 |
--- a/pkg/compiler/lib/src/compiler.dart |
+++ b/pkg/compiler/lib/src/compiler.dart |
@@ -50,7 +50,7 @@ import 'dart_types.dart' show |
import 'deferred_load.dart' show DeferredLoadTask, OutputUnit; |
import 'diagnostics/code_location.dart'; |
import 'diagnostics/diagnostic_listener.dart' show |
- DiagnosticOptions; |
+ DiagnosticReporter; |
import 'diagnostics/invariant.dart' show |
REPORT_EXCESS_RESOLUTION; |
import 'diagnostics/messages.dart' show |
@@ -95,6 +95,10 @@ import 'common/names.dart' show |
import 'null_compiler_output.dart' show |
NullCompilerOutput, |
NullSink; |
+import 'options.dart' show |
+ CompilerOptions, |
+ DiagnosticOptions, |
+ ParserOptions; |
import 'parser/diet_parser_task.dart' show |
DietParserTask; |
import 'parser/element_listener.dart' show |
@@ -191,7 +195,7 @@ abstract class Compiler implements LibraryLoaderListener { |
new ResolutionRegistry(null, new TreeElementMapping(null)); |
/// Options provided from command-line arguments. |
- final api.CompilerOptions options; |
+ final CompilerOptions options; |
/** |
* If true, stop compilation after type inference is complete. Used for |
@@ -356,19 +360,17 @@ abstract class Compiler implements LibraryLoaderListener { |
compilationFailedInternal = value; |
} |
- Compiler({api.CompilerOptions options, |
+ Compiler({CompilerOptions options, |
api.CompilerOutput outputProvider, |
this.environment: const _EmptyEnvironment()}) |
: this.options = options, |
this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport), |
this.userOutputProvider = outputProvider == null |
? const NullCompilerOutput() : outputProvider { |
- |
world = new World(this); |
// TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and |
// make its field final. |
- _reporter = new _CompilerDiagnosticReporter( |
- this, options.diagnosticOptions); |
+ _reporter = new _CompilerDiagnosticReporter(this, options); |
_parsing = new _CompilerParsing(this); |
_resolution = new _CompilerResolution(this); |
_coreTypes = new _CompilerCoreTypes(_resolution); |
@@ -399,8 +401,7 @@ abstract class Compiler implements LibraryLoaderListener { |
} |
tasks = [ |
- dietParser = new DietParserTask( |
- this, enableConditionalDirectives: options.enableConditionalDirectives), |
+ dietParser = new DietParserTask(this, parsing.parserOptions), |
scanner = createScannerTask(), |
serialization = new SerializationTask(this), |
libraryLoader = new LibraryLoaderTask(this, |
@@ -410,10 +411,8 @@ abstract class Compiler implements LibraryLoaderListener { |
this.serialization, |
this, |
environment), |
- parser = new ParserTask(this, |
- enableConditionalDirectives: options.enableConditionalDirectives), |
- patchParser = new PatchParserTask( |
- this, enableConditionalDirectives: options.enableConditionalDirectives), |
+ parser = new ParserTask(this, parsing.parserOptions), |
+ patchParser = new PatchParserTask(this, parsing.parserOptions), |
resolver = createResolverTask(), |
closureToClassMapper = new closureMapping.ClosureTask(this), |
checker = new TypeCheckerTask(this), |
@@ -2103,10 +2102,10 @@ class _CompilerParsing implements Parsing { |
}); |
} |
- ScannerOptions getScannerOptionsFor(Element element) { |
- return new ScannerOptions( |
- canUseNative: compiler.backend.canLibraryUseNative(element.library)); |
- } |
+ ScannerOptions getScannerOptionsFor(Element element) => |
+ new ScannerOptions.from(compiler, element.library); |
+ |
+ ParserOptions get parserOptions => compiler.options; |
} |
class GlobalDependencyRegistry extends EagerRegistry { |