| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.options; | 5 library dart2js.src.options; |
| 6 | 6 |
| 7 import '../compiler.dart' show PackagesDiscoveryProvider; | 7 import '../compiler.dart' show PackagesDiscoveryProvider; |
| 8 import 'commandline_options.dart' show Flags; | 8 import 'commandline_options.dart' show Flags; |
| 9 | 9 |
| 10 /// Options used for controlling diagnostic messages. | 10 /// Options used for controlling diagnostic messages. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 /// When enabled the compiler will use the unified front-end to compile | 207 /// When enabled the compiler will use the unified front-end to compile |
| 208 /// sources to kernel, and then continue compilation from the kernel | 208 /// sources to kernel, and then continue compilation from the kernel |
| 209 /// representation. Setting this flag will implicitly set [useKernelInSsa] to | 209 /// representation. Setting this flag will implicitly set [useKernelInSsa] to |
| 210 /// true as well. | 210 /// true as well. |
| 211 /// | 211 /// |
| 212 /// When this flag is on, the compiler also acccepts reading .dill files from | 212 /// When this flag is on, the compiler also acccepts reading .dill files from |
| 213 /// disk. The compiler reads the sources differently depending on the | 213 /// disk. The compiler reads the sources differently depending on the |
| 214 /// extension format. | 214 /// extension format. |
| 215 final bool useKernel; | 215 final bool useKernel; |
| 216 | 216 |
| 217 // Whether to use kernel internally for global type inference calculations. | |
| 218 // TODO(efortuna): Remove this and consolidate with useKernel. | |
| 219 final bool kernelGlobalInference; | |
| 220 | |
| 221 /// When obfuscating for minification, whether to use the frequency of a name | 217 /// When obfuscating for minification, whether to use the frequency of a name |
| 222 /// as an heuristic to pick shorter names. | 218 /// as an heuristic to pick shorter names. |
| 223 final bool useFrequencyNamer; | 219 final bool useFrequencyNamer; |
| 224 | 220 |
| 225 /// Whether to generate source-information from both the old and the new | 221 /// Whether to generate source-information from both the old and the new |
| 226 /// source-information engines. (experimental) | 222 /// source-information engines. (experimental) |
| 227 final bool useMultiSourceInfo; | 223 final bool useMultiSourceInfo; |
| 228 | 224 |
| 229 /// Whether to use the new source-information implementation for source-maps. | 225 /// Whether to use the new source-information implementation for source-maps. |
| 230 /// (experimental) | 226 /// (experimental) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 302 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 307 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode) || | 303 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode) || |
| 308 _hasOption(options, Flags.enableAsserts), | 304 _hasOption(options, Flags.enableAsserts), |
| 309 experimentalTrackAllocations: | 305 experimentalTrackAllocations: |
| 310 _hasOption(options, Flags.experimentalTrackAllocations), | 306 _hasOption(options, Flags.experimentalTrackAllocations), |
| 311 experimentalAllocationsPath: _extractStringOption( | 307 experimentalAllocationsPath: _extractStringOption( |
| 312 options, "${Flags.experimentalAllocationsPath}=", null), | 308 options, "${Flags.experimentalAllocationsPath}=", null), |
| 313 generateCodeWithCompileTimeErrors: | 309 generateCodeWithCompileTimeErrors: |
| 314 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 310 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 315 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 311 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| 316 kernelGlobalInference: _hasOption(options, Flags.kernelGlobalInference), | |
| 317 outputUri: _extractUriOption(options, '--out='), | 312 outputUri: _extractUriOption(options, '--out='), |
| 318 platformConfigUri: | 313 platformConfigUri: |
| 319 _resolvePlatformConfigFromOptions(libraryRoot, options), | 314 _resolvePlatformConfigFromOptions(libraryRoot, options), |
| 320 preserveComments: _hasOption(options, Flags.preserveComments), | 315 preserveComments: _hasOption(options, Flags.preserveComments), |
| 321 preserveUris: _hasOption(options, Flags.preserveUris), | 316 preserveUris: _hasOption(options, Flags.preserveUris), |
| 322 resolutionInputs: resolutionInputs, | 317 resolutionInputs: resolutionInputs, |
| 323 resolutionOutput: resolutionOutput, | 318 resolutionOutput: resolutionOutput, |
| 324 resolveOnly: _hasOption(options, Flags.resolveOnly), | 319 resolveOnly: _hasOption(options, Flags.resolveOnly), |
| 325 sourceMapUri: _extractUriOption(options, '--source-map='), | 320 sourceMapUri: _extractUriOption(options, '--source-map='), |
| 326 strips: _extractCsvOption(options, '--force-strip='), | 321 strips: _extractCsvOption(options, '--force-strip='), |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 enableExperimentalMirrors: enableExperimentalMirrors, | 442 enableExperimentalMirrors: enableExperimentalMirrors, |
| 448 enableMinification: enableMinification, | 443 enableMinification: enableMinification, |
| 449 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 444 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
| 450 enableTypeAssertions: enableTypeAssertions, | 445 enableTypeAssertions: enableTypeAssertions, |
| 451 enableUserAssertions: enableUserAssertions, | 446 enableUserAssertions: enableUserAssertions, |
| 452 experimentalTrackAllocations: experimentalTrackAllocations, | 447 experimentalTrackAllocations: experimentalTrackAllocations, |
| 453 experimentalAllocationsPath: experimentalAllocationsPath, | 448 experimentalAllocationsPath: experimentalAllocationsPath, |
| 454 generateCodeWithCompileTimeErrors: | 449 generateCodeWithCompileTimeErrors: |
| 455 generateCodeWithCompileTimeErrors && !useKernel, | 450 generateCodeWithCompileTimeErrors && !useKernel, |
| 456 generateSourceMap: generateSourceMap, | 451 generateSourceMap: generateSourceMap, |
| 457 kernelGlobalInference: kernelGlobalInference, | |
| 458 outputUri: outputUri, | 452 outputUri: outputUri, |
| 459 platformConfigUri: platformConfigUri ?? | 453 platformConfigUri: platformConfigUri ?? |
| 460 _resolvePlatformConfig(libraryRoot, null, const []), | 454 _resolvePlatformConfig(libraryRoot, null, const []), |
| 461 preserveComments: preserveComments, | 455 preserveComments: preserveComments, |
| 462 preserveUris: preserveUris, | 456 preserveUris: preserveUris, |
| 463 resolutionInputs: resolutionInputs, | 457 resolutionInputs: resolutionInputs, |
| 464 resolutionOutput: resolutionOutput, | 458 resolutionOutput: resolutionOutput, |
| 465 resolveOnly: resolveOnly, | 459 resolveOnly: resolveOnly, |
| 466 sourceMapUri: sourceMapUri, | 460 sourceMapUri: sourceMapUri, |
| 467 strips: strips, | 461 strips: strips, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 this.enableAssertMessage: true, | 494 this.enableAssertMessage: true, |
| 501 this.enableExperimentalMirrors: false, | 495 this.enableExperimentalMirrors: false, |
| 502 this.enableMinification: false, | 496 this.enableMinification: false, |
| 503 this.enableNativeLiveTypeAnalysis: false, | 497 this.enableNativeLiveTypeAnalysis: false, |
| 504 this.enableTypeAssertions: false, | 498 this.enableTypeAssertions: false, |
| 505 this.enableUserAssertions: false, | 499 this.enableUserAssertions: false, |
| 506 this.experimentalTrackAllocations: false, | 500 this.experimentalTrackAllocations: false, |
| 507 this.experimentalAllocationsPath: null, | 501 this.experimentalAllocationsPath: null, |
| 508 this.generateCodeWithCompileTimeErrors: false, | 502 this.generateCodeWithCompileTimeErrors: false, |
| 509 this.generateSourceMap: true, | 503 this.generateSourceMap: true, |
| 510 this.kernelGlobalInference: false, | |
| 511 this.outputUri: null, | 504 this.outputUri: null, |
| 512 this.platformConfigUri: null, | 505 this.platformConfigUri: null, |
| 513 this.preserveComments: false, | 506 this.preserveComments: false, |
| 514 this.preserveUris: false, | 507 this.preserveUris: false, |
| 515 this.resolutionInputs: null, | 508 this.resolutionInputs: null, |
| 516 this.resolutionOutput: null, | 509 this.resolutionOutput: null, |
| 517 this.resolveOnly: false, | 510 this.resolveOnly: false, |
| 518 this.compileOnly: false, | 511 this.compileOnly: false, |
| 519 this.sourceMapUri: null, | 512 this.sourceMapUri: null, |
| 520 this.strips: const [], | 513 this.strips: const [], |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 enableTypeAssertions ?? options.enableTypeAssertions, | 621 enableTypeAssertions ?? options.enableTypeAssertions, |
| 629 enableUserAssertions: | 622 enableUserAssertions: |
| 630 enableUserAssertions ?? options.enableUserAssertions, | 623 enableUserAssertions ?? options.enableUserAssertions, |
| 631 experimentalTrackAllocations: experimentalTrackAllocations ?? | 624 experimentalTrackAllocations: experimentalTrackAllocations ?? |
| 632 options.experimentalTrackAllocations, | 625 options.experimentalTrackAllocations, |
| 633 experimentalAllocationsPath: | 626 experimentalAllocationsPath: |
| 634 experimentalAllocationsPath ?? options.experimentalAllocationsPath, | 627 experimentalAllocationsPath ?? options.experimentalAllocationsPath, |
| 635 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 628 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
| 636 options.generateCodeWithCompileTimeErrors, | 629 options.generateCodeWithCompileTimeErrors, |
| 637 generateSourceMap: generateSourceMap ?? options.generateSourceMap, | 630 generateSourceMap: generateSourceMap ?? options.generateSourceMap, |
| 638 kernelGlobalInference: | |
| 639 kernelGlobalInference ?? options.kernelGlobalInference, | |
| 640 outputUri: outputUri ?? options.outputUri, | 631 outputUri: outputUri ?? options.outputUri, |
| 641 platformConfigUri: platformConfigUri ?? options.platformConfigUri, | 632 platformConfigUri: platformConfigUri ?? options.platformConfigUri, |
| 642 preserveComments: preserveComments ?? options.preserveComments, | 633 preserveComments: preserveComments ?? options.preserveComments, |
| 643 preserveUris: preserveUris ?? options.preserveUris, | 634 preserveUris: preserveUris ?? options.preserveUris, |
| 644 resolutionInputs: resolutionInputs ?? options.resolutionInputs, | 635 resolutionInputs: resolutionInputs ?? options.resolutionInputs, |
| 645 resolutionOutput: resolutionOutput ?? options.resolutionOutput, | 636 resolutionOutput: resolutionOutput ?? options.resolutionOutput, |
| 646 resolveOnly: resolveOnly ?? options.resolveOnly, | 637 resolveOnly: resolveOnly ?? options.resolveOnly, |
| 647 compileOnly: compileOnly ?? options.compileOnly, | 638 compileOnly: compileOnly ?? options.compileOnly, |
| 648 sourceMapUri: sourceMapUri ?? options.sourceMapUri, | 639 sourceMapUri: sourceMapUri ?? options.sourceMapUri, |
| 649 strips: strips ?? options.strips, | 640 strips: strips ?? options.strips, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 _extractStringOption(options, "--platform-config=", null), | 747 _extractStringOption(options, "--platform-config=", null), |
| 757 _extractCsvOption(options, '--categories=')); | 748 _extractCsvOption(options, '--categories=')); |
| 758 } | 749 } |
| 759 | 750 |
| 760 /// Locations of the platform descriptor files relative to the library root. | 751 /// Locations of the platform descriptor files relative to the library root. |
| 761 const String _clientPlatform = "lib/dart_client.platform"; | 752 const String _clientPlatform = "lib/dart_client.platform"; |
| 762 const String _serverPlatform = "lib/dart_server.platform"; | 753 const String _serverPlatform = "lib/dart_server.platform"; |
| 763 const String _sharedPlatform = "lib/dart_shared.platform"; | 754 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 764 | 755 |
| 765 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 756 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| OLD | NEW |