Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a | 
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 library dart2js.compiler_base; | 5 library dart2js.compiler_base; | 
| 6 | 6 | 
| 7 import 'dart:async' show | 7 import 'dart:async' show | 
| 8 EventSink, | 8 EventSink, | 
| 9 Future; | 9 Future; | 
| 10 | 10 | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 import 'mirrors_used.dart' show | 85 import 'mirrors_used.dart' show | 
| 86 MirrorUsageAnalyzerTask; | 86 MirrorUsageAnalyzerTask; | 
| 87 import 'common/names.dart' show | 87 import 'common/names.dart' show | 
| 88 Selectors; | 88 Selectors; | 
| 89 import 'null_compiler_output.dart' show | 89 import 'null_compiler_output.dart' show | 
| 90 NullCompilerOutput, | 90 NullCompilerOutput, | 
| 91 NullSink; | 91 NullSink; | 
| 92 import 'parser/diet_parser_task.dart' show | 92 import 'parser/diet_parser_task.dart' show | 
| 93 DietParserTask; | 93 DietParserTask; | 
| 94 import 'parser/element_listener.dart' show | 94 import 'parser/element_listener.dart' show | 
| 95 ParserOptions, | |
| 95 ScannerOptions; | 96 ScannerOptions; | 
| 96 import 'parser/parser_task.dart' show | 97 import 'parser/parser_task.dart' show | 
| 97 ParserTask; | 98 ParserTask; | 
| 98 import 'patch_parser.dart' show | 99 import 'patch_parser.dart' show | 
| 99 PatchParserTask; | 100 PatchParserTask; | 
| 100 import 'resolution/registry.dart' show | 101 import 'resolution/registry.dart' show | 
| 101 ResolutionRegistry; | 102 ResolutionRegistry; | 
| 102 import 'resolution/resolution.dart' show | 103 import 'resolution/resolution.dart' show | 
| 103 ResolverTask; | 104 ResolverTask; | 
| 104 import 'resolution/tree_elements.dart' show | 105 import 'resolution/tree_elements.dart' show | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 final bool enableUserAssertions; | 196 final bool enableUserAssertions; | 
| 196 final bool trustTypeAnnotations; | 197 final bool trustTypeAnnotations; | 
| 197 final bool trustPrimitives; | 198 final bool trustPrimitives; | 
| 198 final bool trustJSInteropTypeAnnotations; | 199 final bool trustJSInteropTypeAnnotations; | 
| 199 final bool disableTypeInferenceFlag; | 200 final bool disableTypeInferenceFlag; | 
| 200 final Uri deferredMapUri; | 201 final Uri deferredMapUri; | 
| 201 final bool dumpInfo; | 202 final bool dumpInfo; | 
| 202 final bool useContentSecurityPolicy; | 203 final bool useContentSecurityPolicy; | 
| 203 final bool enableExperimentalMirrors; | 204 final bool enableExperimentalMirrors; | 
| 204 final bool enableAssertMessage; | 205 final bool enableAssertMessage; | 
| 206 final bool enableConditionalDirectives; | |
| 207 final bool enableGenericMethods; | |
| 205 | 208 | 
| 206 /** | 209 /** | 
| 207 * The maximum size of a concrete type before it widens to dynamic during | 210 * The maximum size of a concrete type before it widens to dynamic during | 
| 208 * concrete type inference. | 211 * concrete type inference. | 
| 209 */ | 212 */ | 
| 210 final int maxConcreteTypeSize; | 213 final int maxConcreteTypeSize; | 
| 211 final bool analyzeAllFlag; | 214 final bool analyzeAllFlag; | 
| 212 final bool analyzeOnly; | 215 final bool analyzeOnly; | 
| 213 | 216 | 
| 214 /// If true, disable tree-shaking for the main script. | 217 /// If true, disable tree-shaking for the main script. | 
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 this.preserveComments: false, | 450 this.preserveComments: false, | 
| 448 this.useCpsIr: false, | 451 this.useCpsIr: false, | 
| 449 this.useFrequencyNamer: false, | 452 this.useFrequencyNamer: false, | 
| 450 this.verbose: false, | 453 this.verbose: false, | 
| 451 this.sourceMapUri: null, | 454 this.sourceMapUri: null, | 
| 452 this.outputUri: null, | 455 this.outputUri: null, | 
| 453 this.buildId: UNDETERMINED_BUILD_ID, | 456 this.buildId: UNDETERMINED_BUILD_ID, | 
| 454 this.deferredMapUri: null, | 457 this.deferredMapUri: null, | 
| 455 this.dumpInfo: false, | 458 this.dumpInfo: false, | 
| 456 bool useStartupEmitter: false, | 459 bool useStartupEmitter: false, | 
| 457 bool enableConditionalDirectives: false, | 460 this.enableConditionalDirectives: false, | 
| 461 this.enableGenericMethods: false, | |
| 458 this.useContentSecurityPolicy: false, | 462 this.useContentSecurityPolicy: false, | 
| 459 bool hasIncrementalSupport: false, | 463 bool hasIncrementalSupport: false, | 
| 460 this.enableExperimentalMirrors: false, | 464 this.enableExperimentalMirrors: false, | 
| 461 this.enableAssertMessage: false, | 465 this.enableAssertMessage: false, | 
| 462 this.allowNativeExtensions: false, | 466 this.allowNativeExtensions: false, | 
| 463 this.generateCodeWithCompileTimeErrors: false, | 467 this.generateCodeWithCompileTimeErrors: false, | 
| 464 this.testMode: false, | 468 this.testMode: false, | 
| 465 DiagnosticOptions diagnosticOptions, | 469 DiagnosticOptions diagnosticOptions, | 
| 466 api.CompilerOutput outputProvider, | 470 api.CompilerOutput outputProvider, | 
| 467 List<String> strips: const []}) | 471 List<String> strips: const []}) | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 if (dumpInfo) { | 514 if (dumpInfo) { | 
| 511 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 515 throw new ArgumentError('--dump-info is not supported for dart2dart.'); | 
| 512 } | 516 } | 
| 513 } | 517 } | 
| 514 | 518 | 
| 515 tasks = [ | 519 tasks = [ | 
| 516 libraryLoader = new LibraryLoaderTask(this), | 520 libraryLoader = new LibraryLoaderTask(this), | 
| 517 serialization = new SerializationTask(this), | 521 serialization = new SerializationTask(this), | 
| 518 scanner = new ScannerTask(this), | 522 scanner = new ScannerTask(this), | 
| 519 dietParser = new DietParserTask( | 523 dietParser = new DietParserTask( | 
| 520 this, enableConditionalDirectives: enableConditionalDirectives), | 524 this, | 
| 525 enableConditionalDirectives: enableConditionalDirectives, | |
| 526 enableGenericMethods: enableGenericMethods), | |
| 
 
Johnni Winther
2016/02/29 10:18:45
Pass [parserOptions] instead. (Also below)
 
eernst
2016/03/09 16:28:13
Right, it is clearly better to keep multiple optio
 
 | |
| 521 parser = new ParserTask( | 527 parser = new ParserTask( | 
| 522 this, enableConditionalDirectives: enableConditionalDirectives), | 528 this, | 
| 529 enableConditionalDirectives: enableConditionalDirectives, | |
| 530 enableGenericMethods: enableGenericMethods), | |
| 523 patchParser = new PatchParserTask( | 531 patchParser = new PatchParserTask( | 
| 524 this, enableConditionalDirectives: enableConditionalDirectives), | 532 this, | 
| 533 enableConditionalDirectives: enableConditionalDirectives, | |
| 534 enableGenericMethods: enableGenericMethods), | |
| 525 resolver = new ResolverTask(this, backend.constantCompilerTask), | 535 resolver = new ResolverTask(this, backend.constantCompilerTask), | 
| 526 closureToClassMapper = new closureMapping.ClosureTask(this), | 536 closureToClassMapper = new closureMapping.ClosureTask(this), | 
| 527 checker = new TypeCheckerTask(this), | 537 checker = new TypeCheckerTask(this), | 
| 528 typesTask = new ti.TypesTask(this), | 538 typesTask = new ti.TypesTask(this), | 
| 529 constants = backend.constantCompilerTask, | 539 constants = backend.constantCompilerTask, | 
| 530 deferredLoadTask = new DeferredLoadTask(this), | 540 deferredLoadTask = new DeferredLoadTask(this), | 
| 531 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 541 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 
| 532 enqueuer = new EnqueueTask(this), | 542 enqueuer = new EnqueueTask(this), | 
| 533 dumpInfoTask = new DumpInfoTask(this), | 543 dumpInfoTask = new DumpInfoTask(this), | 
| 534 reuseLibraryTask = new GenericTask('Reuse library', this), | 544 reuseLibraryTask = new GenericTask('Reuse library', this), | 
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2177 if (cls.isPatch) { | 2187 if (cls.isPatch) { | 
| 2178 compiler.patchParser.parsePatchClassNode(cls); | 2188 compiler.patchParser.parsePatchClassNode(cls); | 
| 2179 } | 2189 } | 
| 2180 }); | 2190 }); | 
| 2181 } | 2191 } | 
| 2182 | 2192 | 
| 2183 ScannerOptions getScannerOptionsFor(Element element) { | 2193 ScannerOptions getScannerOptionsFor(Element element) { | 
| 2184 return new ScannerOptions( | 2194 return new ScannerOptions( | 
| 2185 canUseNative: compiler.backend.canLibraryUseNative(element.library)); | 2195 canUseNative: compiler.backend.canLibraryUseNative(element.library)); | 
| 2186 } | 2196 } | 
| 2197 | |
| 2198 @override | |
| 2199 ParserOptions get parserOptions { | |
| 2200 return new ParserOptions( | |
| 2201 enableConditionalDirectives: compiler.enableConditionalDirectives, | |
| 2202 enableGenericMethods: compiler.enableGenericMethods); | |
| 2203 } | |
| 2187 } | 2204 } | 
| 2188 | 2205 | 
| 2189 class GlobalDependencyRegistry extends EagerRegistry { | 2206 class GlobalDependencyRegistry extends EagerRegistry { | 
| 2190 final Compiler compiler; | 2207 final Compiler compiler; | 
| 2191 Setlet<Element> _otherDependencies; | 2208 Setlet<Element> _otherDependencies; | 
| 2192 | 2209 | 
| 2193 GlobalDependencyRegistry(this.compiler) : super('GlobalDependencies', null); | 2210 GlobalDependencyRegistry(this.compiler) : super('GlobalDependencies', null); | 
| 2194 | 2211 | 
| 2195 // TODO(johnniwinther): Rename world/universe/enqueuer through out the | 2212 // TODO(johnniwinther): Rename world/universe/enqueuer through out the | 
| 2196 // compiler. | 2213 // compiler. | 
| 2197 @override | 2214 @override | 
| 2198 Enqueuer get world => compiler.enqueuer.codegen; | 2215 Enqueuer get world => compiler.enqueuer.codegen; | 
| 2199 | 2216 | 
| 2200 void registerDependency(Element element) { | 2217 void registerDependency(Element element) { | 
| 2201 if (element == null) return; | 2218 if (element == null) return; | 
| 2202 if (_otherDependencies == null) { | 2219 if (_otherDependencies == null) { | 
| 2203 _otherDependencies = new Setlet<Element>(); | 2220 _otherDependencies = new Setlet<Element>(); | 
| 2204 } | 2221 } | 
| 2205 _otherDependencies.add(element.implementation); | 2222 _otherDependencies.add(element.implementation); | 
| 2206 } | 2223 } | 
| 2207 | 2224 | 
| 2208 Iterable<Element> get otherDependencies { | 2225 Iterable<Element> get otherDependencies { | 
| 2209 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2226 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 
| 2210 } | 2227 } | 
| 2211 } | 2228 } | 
| OLD | NEW |