| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 /// Whether to trust type annotations during inference and optimizations. | 196 /// Whether to trust type annotations during inference and optimizations. |
| 197 final bool trustTypeAnnotations; | 197 final bool trustTypeAnnotations; |
| 198 | 198 |
| 199 /// Whether to generate code compliant with content security policy (CSP). | 199 /// Whether to generate code compliant with content security policy (CSP). |
| 200 final bool useContentSecurityPolicy; | 200 final bool useContentSecurityPolicy; |
| 201 | 201 |
| 202 /// Whether to use kernel internally as part of compilation. | 202 /// Whether to use kernel internally as part of compilation. |
| 203 final bool useKernel; | 203 final bool useKernel; |
| 204 | 204 |
| 205 // Whether to use kernel internally for global type inference calculations. |
| 206 // TODO(efortuna): Remove this and consolidate with useKernel. |
| 207 final bool kernelGlobalInference; |
| 208 |
| 205 /// When obfuscating for minification, whether to use the frequency of a name | 209 /// When obfuscating for minification, whether to use the frequency of a name |
| 206 /// as an heuristic to pick shorter names. | 210 /// as an heuristic to pick shorter names. |
| 207 final bool useFrequencyNamer; | 211 final bool useFrequencyNamer; |
| 208 | 212 |
| 209 /// Whether to generate source-information from both the old and the new | 213 /// Whether to generate source-information from both the old and the new |
| 210 /// source-information engines. (experimental) | 214 /// source-information engines. (experimental) |
| 211 final bool useMultiSourceInfo; | 215 final bool useMultiSourceInfo; |
| 212 | 216 |
| 213 /// Whether to use the new source-information implementation for source-maps. | 217 /// Whether to use the new source-information implementation for source-maps. |
| 214 /// (experimental) | 218 /// (experimental) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 enableExperimentalMirrors: | 276 enableExperimentalMirrors: |
| 273 _hasOption(options, Flags.enableExperimentalMirrors), | 277 _hasOption(options, Flags.enableExperimentalMirrors), |
| 274 enableMinification: _hasOption(options, Flags.minify), | 278 enableMinification: _hasOption(options, Flags.minify), |
| 275 enableNativeLiveTypeAnalysis: | 279 enableNativeLiveTypeAnalysis: |
| 276 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 280 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
| 277 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 281 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 278 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 282 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 279 generateCodeWithCompileTimeErrors: | 283 generateCodeWithCompileTimeErrors: |
| 280 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 284 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 281 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 285 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| 286 kernelGlobalInference: _hasOption(options, Flags.kernelGlobalInference), |
| 282 outputUri: _extractUriOption(options, '--out='), | 287 outputUri: _extractUriOption(options, '--out='), |
| 283 platformConfigUri: | 288 platformConfigUri: |
| 284 _resolvePlatformConfigFromOptions(libraryRoot, options), | 289 _resolvePlatformConfigFromOptions(libraryRoot, options), |
| 285 preserveComments: _hasOption(options, Flags.preserveComments), | 290 preserveComments: _hasOption(options, Flags.preserveComments), |
| 286 preserveUris: _hasOption(options, Flags.preserveUris), | 291 preserveUris: _hasOption(options, Flags.preserveUris), |
| 287 resolutionInputs: resolutionInputs, | 292 resolutionInputs: resolutionInputs, |
| 288 resolutionOutput: resolutionOutput, | 293 resolutionOutput: resolutionOutput, |
| 289 resolveOnly: _hasOption(options, Flags.resolveOnly), | 294 resolveOnly: _hasOption(options, Flags.resolveOnly), |
| 290 sourceMapUri: _extractUriOption(options, '--source-map='), | 295 sourceMapUri: _extractUriOption(options, '--source-map='), |
| 291 strips: _extractCsvOption(options, '--force-strip='), | 296 strips: _extractCsvOption(options, '--force-strip='), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 bool disableTypeInference: false, | 339 bool disableTypeInference: false, |
| 335 bool dumpInfo: false, | 340 bool dumpInfo: false, |
| 336 bool enableAssertMessage: true, | 341 bool enableAssertMessage: true, |
| 337 bool enableExperimentalMirrors: false, | 342 bool enableExperimentalMirrors: false, |
| 338 bool enableMinification: false, | 343 bool enableMinification: false, |
| 339 bool enableNativeLiveTypeAnalysis: true, | 344 bool enableNativeLiveTypeAnalysis: true, |
| 340 bool enableTypeAssertions: false, | 345 bool enableTypeAssertions: false, |
| 341 bool enableUserAssertions: false, | 346 bool enableUserAssertions: false, |
| 342 bool generateCodeWithCompileTimeErrors: false, | 347 bool generateCodeWithCompileTimeErrors: false, |
| 343 bool generateSourceMap: true, | 348 bool generateSourceMap: true, |
| 349 bool kernelGlobalInference: false, |
| 344 Uri outputUri: null, | 350 Uri outputUri: null, |
| 345 Uri platformConfigUri: null, | 351 Uri platformConfigUri: null, |
| 346 bool preserveComments: false, | 352 bool preserveComments: false, |
| 347 bool preserveUris: false, | 353 bool preserveUris: false, |
| 348 List<Uri> resolutionInputs: null, | 354 List<Uri> resolutionInputs: null, |
| 349 Uri resolutionOutput: null, | 355 Uri resolutionOutput: null, |
| 350 bool resolveOnly: false, | 356 bool resolveOnly: false, |
| 351 Uri sourceMapUri: null, | 357 Uri sourceMapUri: null, |
| 352 List<String> strips: const [], | 358 List<String> strips: const [], |
| 353 bool testMode: false, | 359 bool testMode: false, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 disableTypeInference: disableTypeInference, | 410 disableTypeInference: disableTypeInference, |
| 405 dumpInfo: dumpInfo, | 411 dumpInfo: dumpInfo, |
| 406 enableAssertMessage: enableAssertMessage, | 412 enableAssertMessage: enableAssertMessage, |
| 407 enableExperimentalMirrors: enableExperimentalMirrors, | 413 enableExperimentalMirrors: enableExperimentalMirrors, |
| 408 enableMinification: enableMinification, | 414 enableMinification: enableMinification, |
| 409 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 415 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
| 410 enableTypeAssertions: enableTypeAssertions, | 416 enableTypeAssertions: enableTypeAssertions, |
| 411 enableUserAssertions: enableUserAssertions, | 417 enableUserAssertions: enableUserAssertions, |
| 412 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 418 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
| 413 generateSourceMap: generateSourceMap, | 419 generateSourceMap: generateSourceMap, |
| 420 kernelGlobalInference: kernelGlobalInference, |
| 414 outputUri: outputUri, | 421 outputUri: outputUri, |
| 415 platformConfigUri: platformConfigUri ?? | 422 platformConfigUri: platformConfigUri ?? |
| 416 _resolvePlatformConfig(libraryRoot, null, const []), | 423 _resolvePlatformConfig(libraryRoot, null, const []), |
| 417 preserveComments: preserveComments, | 424 preserveComments: preserveComments, |
| 418 preserveUris: preserveUris, | 425 preserveUris: preserveUris, |
| 419 resolutionInputs: resolutionInputs, | 426 resolutionInputs: resolutionInputs, |
| 420 resolutionOutput: resolutionOutput, | 427 resolutionOutput: resolutionOutput, |
| 421 resolveOnly: resolveOnly, | 428 resolveOnly: resolveOnly, |
| 422 sourceMapUri: sourceMapUri, | 429 sourceMapUri: sourceMapUri, |
| 423 strips: strips, | 430 strips: strips, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 453 this.disableTypeInference: false, | 460 this.disableTypeInference: false, |
| 454 this.dumpInfo: false, | 461 this.dumpInfo: false, |
| 455 this.enableAssertMessage: true, | 462 this.enableAssertMessage: true, |
| 456 this.enableExperimentalMirrors: false, | 463 this.enableExperimentalMirrors: false, |
| 457 this.enableMinification: false, | 464 this.enableMinification: false, |
| 458 this.enableNativeLiveTypeAnalysis: false, | 465 this.enableNativeLiveTypeAnalysis: false, |
| 459 this.enableTypeAssertions: false, | 466 this.enableTypeAssertions: false, |
| 460 this.enableUserAssertions: false, | 467 this.enableUserAssertions: false, |
| 461 this.generateCodeWithCompileTimeErrors: false, | 468 this.generateCodeWithCompileTimeErrors: false, |
| 462 this.generateSourceMap: true, | 469 this.generateSourceMap: true, |
| 470 this.kernelGlobalInference: false, |
| 463 this.outputUri: null, | 471 this.outputUri: null, |
| 464 this.platformConfigUri: null, | 472 this.platformConfigUri: null, |
| 465 this.preserveComments: false, | 473 this.preserveComments: false, |
| 466 this.preserveUris: false, | 474 this.preserveUris: false, |
| 467 this.resolutionInputs: null, | 475 this.resolutionInputs: null, |
| 468 this.resolutionOutput: null, | 476 this.resolutionOutput: null, |
| 469 this.resolveOnly: false, | 477 this.resolveOnly: false, |
| 470 this.compileOnly: false, | 478 this.compileOnly: false, |
| 471 this.sourceMapUri: null, | 479 this.sourceMapUri: null, |
| 472 this.strips: const [], | 480 this.strips: const [], |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 disableTypeInference, | 517 disableTypeInference, |
| 510 dumpInfo, | 518 dumpInfo, |
| 511 enableAssertMessage, | 519 enableAssertMessage, |
| 512 enableExperimentalMirrors, | 520 enableExperimentalMirrors, |
| 513 enableMinification, | 521 enableMinification, |
| 514 enableNativeLiveTypeAnalysis, | 522 enableNativeLiveTypeAnalysis, |
| 515 enableTypeAssertions, | 523 enableTypeAssertions, |
| 516 enableUserAssertions, | 524 enableUserAssertions, |
| 517 generateCodeWithCompileTimeErrors, | 525 generateCodeWithCompileTimeErrors, |
| 518 generateSourceMap, | 526 generateSourceMap, |
| 527 kernelGlobalInference, |
| 519 outputUri, | 528 outputUri, |
| 520 platformConfigUri, | 529 platformConfigUri, |
| 521 preserveComments, | 530 preserveComments, |
| 522 preserveUris, | 531 preserveUris, |
| 523 resolutionInputs, | 532 resolutionInputs, |
| 524 resolutionOutput, | 533 resolutionOutput, |
| 525 resolveOnly, | 534 resolveOnly, |
| 526 compileOnly, | 535 compileOnly, |
| 527 sourceMapUri, | 536 sourceMapUri, |
| 528 strips, | 537 strips, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 enableMinification: enableMinification ?? options.enableMinification, | 580 enableMinification: enableMinification ?? options.enableMinification, |
| 572 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? | 581 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? |
| 573 options.enableNativeLiveTypeAnalysis, | 582 options.enableNativeLiveTypeAnalysis, |
| 574 enableTypeAssertions: | 583 enableTypeAssertions: |
| 575 enableTypeAssertions ?? options.enableTypeAssertions, | 584 enableTypeAssertions ?? options.enableTypeAssertions, |
| 576 enableUserAssertions: | 585 enableUserAssertions: |
| 577 enableUserAssertions ?? options.enableUserAssertions, | 586 enableUserAssertions ?? options.enableUserAssertions, |
| 578 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 587 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
| 579 options.generateCodeWithCompileTimeErrors, | 588 options.generateCodeWithCompileTimeErrors, |
| 580 generateSourceMap: generateSourceMap ?? options.generateSourceMap, | 589 generateSourceMap: generateSourceMap ?? options.generateSourceMap, |
| 590 kernelGlobalInference: |
| 591 kernelGlobalInference ?? options.kernelGlobalInference, |
| 581 outputUri: outputUri ?? options.outputUri, | 592 outputUri: outputUri ?? options.outputUri, |
| 582 platformConfigUri: platformConfigUri ?? options.platformConfigUri, | 593 platformConfigUri: platformConfigUri ?? options.platformConfigUri, |
| 583 preserveComments: preserveComments ?? options.preserveComments, | 594 preserveComments: preserveComments ?? options.preserveComments, |
| 584 preserveUris: preserveUris ?? options.preserveUris, | 595 preserveUris: preserveUris ?? options.preserveUris, |
| 585 resolutionInputs: resolutionInputs ?? options.resolutionInputs, | 596 resolutionInputs: resolutionInputs ?? options.resolutionInputs, |
| 586 resolutionOutput: resolutionOutput ?? options.resolutionOutput, | 597 resolutionOutput: resolutionOutput ?? options.resolutionOutput, |
| 587 resolveOnly: resolveOnly ?? options.resolveOnly, | 598 resolveOnly: resolveOnly ?? options.resolveOnly, |
| 588 compileOnly: compileOnly ?? options.compileOnly, | 599 compileOnly: compileOnly ?? options.compileOnly, |
| 589 sourceMapUri: sourceMapUri ?? options.sourceMapUri, | 600 sourceMapUri: sourceMapUri ?? options.sourceMapUri, |
| 590 strips: strips ?? options.strips, | 601 strips: strips ?? options.strips, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 _extractStringOption(options, "--platform-config=", null), | 707 _extractStringOption(options, "--platform-config=", null), |
| 697 _extractCsvOption(options, '--categories=')); | 708 _extractCsvOption(options, '--categories=')); |
| 698 } | 709 } |
| 699 | 710 |
| 700 /// Locations of the platform descriptor files relative to the library root. | 711 /// Locations of the platform descriptor files relative to the library root. |
| 701 const String _clientPlatform = "lib/dart_client.platform"; | 712 const String _clientPlatform = "lib/dart_client.platform"; |
| 702 const String _serverPlatform = "lib/dart_server.platform"; | 713 const String _serverPlatform = "lib/dart_server.platform"; |
| 703 const String _sharedPlatform = "lib/dart_shared.platform"; | 714 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 704 | 715 |
| 705 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 716 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| OLD | NEW |