| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 /// Whether to generate code containing user's `assert` statements. | 154 /// Whether to generate code containing user's `assert` statements. |
| 155 final bool enableUserAssertions; | 155 final bool enableUserAssertions; |
| 156 | 156 |
| 157 /// Whether to generate output even when there are compile-time errors. | 157 /// Whether to generate output even when there are compile-time errors. |
| 158 final bool generateCodeWithCompileTimeErrors; | 158 final bool generateCodeWithCompileTimeErrors; |
| 159 | 159 |
| 160 /// Whether to generate a source-map file together with the output program. | 160 /// Whether to generate a source-map file together with the output program. |
| 161 final bool generateSourceMap; | 161 final bool generateSourceMap; |
| 162 | 162 |
| 163 /// Whether some values are cached for reuse in incremental compilation. | |
| 164 /// Incremental compilation allows calling `Compiler.run` more than once | |
| 165 /// (experimental). | |
| 166 final bool hasIncrementalSupport; | |
| 167 | |
| 168 /// URI of the main output if the compiler is generating source maps. | 163 /// URI of the main output if the compiler is generating source maps. |
| 169 final Uri outputUri; | 164 final Uri outputUri; |
| 170 | 165 |
| 171 /// Location of the platform configuration file. | 166 /// Location of the platform configuration file. |
| 172 final Uri platformConfigUri; | 167 final Uri platformConfigUri; |
| 173 | 168 |
| 174 /// Whether to emit URIs in the reflection metadata. | 169 /// Whether to emit URIs in the reflection metadata. |
| 175 final bool preserveUris; | 170 final bool preserveUris; |
| 176 | 171 |
| 177 /// The locations of serialized data used for resolution. | 172 /// The locations of serialized data used for resolution. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 enableExperimentalMirrors: | 268 enableExperimentalMirrors: |
| 274 _hasOption(options, Flags.enableExperimentalMirrors), | 269 _hasOption(options, Flags.enableExperimentalMirrors), |
| 275 enableMinification: _hasOption(options, Flags.minify), | 270 enableMinification: _hasOption(options, Flags.minify), |
| 276 enableNativeLiveTypeAnalysis: | 271 enableNativeLiveTypeAnalysis: |
| 277 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 272 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
| 278 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 273 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 279 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 274 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 280 generateCodeWithCompileTimeErrors: | 275 generateCodeWithCompileTimeErrors: |
| 281 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 276 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 282 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 277 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| 283 hasIncrementalSupport: _forceIncrementalSupport || | |
| 284 _hasOption(options, Flags.incrementalSupport), | |
| 285 outputUri: _extractUriOption(options, '--out='), | 278 outputUri: _extractUriOption(options, '--out='), |
| 286 platformConfigUri: | 279 platformConfigUri: |
| 287 _resolvePlatformConfigFromOptions(libraryRoot, options), | 280 _resolvePlatformConfigFromOptions(libraryRoot, options), |
| 288 preserveComments: _hasOption(options, Flags.preserveComments), | 281 preserveComments: _hasOption(options, Flags.preserveComments), |
| 289 preserveUris: _hasOption(options, Flags.preserveUris), | 282 preserveUris: _hasOption(options, Flags.preserveUris), |
| 290 resolutionInputs: resolutionInputs, | 283 resolutionInputs: resolutionInputs, |
| 291 resolutionOutput: resolutionOutput, | 284 resolutionOutput: resolutionOutput, |
| 292 resolveOnly: _hasOption(options, Flags.resolveOnly), | 285 resolveOnly: _hasOption(options, Flags.resolveOnly), |
| 293 sourceMapUri: _extractUriOption(options, '--source-map='), | 286 sourceMapUri: _extractUriOption(options, '--source-map='), |
| 294 strips: _extractCsvOption(options, '--force-strip='), | 287 strips: _extractCsvOption(options, '--force-strip='), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 bool disableTypeInference: false, | 329 bool disableTypeInference: false, |
| 337 bool dumpInfo: false, | 330 bool dumpInfo: false, |
| 338 bool enableAssertMessage: true, | 331 bool enableAssertMessage: true, |
| 339 bool enableExperimentalMirrors: false, | 332 bool enableExperimentalMirrors: false, |
| 340 bool enableMinification: false, | 333 bool enableMinification: false, |
| 341 bool enableNativeLiveTypeAnalysis: true, | 334 bool enableNativeLiveTypeAnalysis: true, |
| 342 bool enableTypeAssertions: false, | 335 bool enableTypeAssertions: false, |
| 343 bool enableUserAssertions: false, | 336 bool enableUserAssertions: false, |
| 344 bool generateCodeWithCompileTimeErrors: false, | 337 bool generateCodeWithCompileTimeErrors: false, |
| 345 bool generateSourceMap: true, | 338 bool generateSourceMap: true, |
| 346 bool hasIncrementalSupport: false, | |
| 347 Uri outputUri: null, | 339 Uri outputUri: null, |
| 348 Uri platformConfigUri: null, | 340 Uri platformConfigUri: null, |
| 349 bool preserveComments: false, | 341 bool preserveComments: false, |
| 350 bool preserveUris: false, | 342 bool preserveUris: false, |
| 351 List<Uri> resolutionInputs: null, | 343 List<Uri> resolutionInputs: null, |
| 352 Uri resolutionOutput: null, | 344 Uri resolutionOutput: null, |
| 353 bool resolveOnly: false, | 345 bool resolveOnly: false, |
| 354 Uri sourceMapUri: null, | 346 Uri sourceMapUri: null, |
| 355 List<String> strips: const [], | 347 List<String> strips: const [], |
| 356 bool testMode: false, | 348 bool testMode: false, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 analyzeOnly: | 387 analyzeOnly: |
| 396 analyzeOnly || analyzeSignaturesOnly || analyzeAll || resolveOnly, | 388 analyzeOnly || analyzeSignaturesOnly || analyzeAll || resolveOnly, |
| 397 analyzeSignaturesOnly: analyzeSignaturesOnly, | 389 analyzeSignaturesOnly: analyzeSignaturesOnly, |
| 398 buildId: buildId, | 390 buildId: buildId, |
| 399 deferredMapUri: deferredMapUri, | 391 deferredMapUri: deferredMapUri, |
| 400 fatalWarnings: fatalWarnings, | 392 fatalWarnings: fatalWarnings, |
| 401 terseDiagnostics: terseDiagnostics, | 393 terseDiagnostics: terseDiagnostics, |
| 402 suppressWarnings: suppressWarnings, | 394 suppressWarnings: suppressWarnings, |
| 403 suppressHints: suppressHints, | 395 suppressHints: suppressHints, |
| 404 shownPackageWarnings: shownPackageWarnings, | 396 shownPackageWarnings: shownPackageWarnings, |
| 405 disableInlining: disableInlining || hasIncrementalSupport, | 397 disableInlining: disableInlining, |
| 406 disableTypeInference: disableTypeInference, | 398 disableTypeInference: disableTypeInference, |
| 407 dumpInfo: dumpInfo, | 399 dumpInfo: dumpInfo, |
| 408 enableAssertMessage: enableAssertMessage, | 400 enableAssertMessage: enableAssertMessage, |
| 409 enableExperimentalMirrors: enableExperimentalMirrors, | 401 enableExperimentalMirrors: enableExperimentalMirrors, |
| 410 enableMinification: enableMinification, | 402 enableMinification: enableMinification, |
| 411 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 403 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
| 412 enableTypeAssertions: enableTypeAssertions, | 404 enableTypeAssertions: enableTypeAssertions, |
| 413 enableUserAssertions: enableUserAssertions, | 405 enableUserAssertions: enableUserAssertions, |
| 414 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 406 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
| 415 generateSourceMap: generateSourceMap, | 407 generateSourceMap: generateSourceMap, |
| 416 hasIncrementalSupport: hasIncrementalSupport, | |
| 417 outputUri: outputUri, | 408 outputUri: outputUri, |
| 418 platformConfigUri: platformConfigUri ?? | 409 platformConfigUri: platformConfigUri ?? |
| 419 _resolvePlatformConfig(libraryRoot, null, const []), | 410 _resolvePlatformConfig(libraryRoot, null, const []), |
| 420 preserveComments: preserveComments, | 411 preserveComments: preserveComments, |
| 421 preserveUris: preserveUris, | 412 preserveUris: preserveUris, |
| 422 resolutionInputs: resolutionInputs, | 413 resolutionInputs: resolutionInputs, |
| 423 resolutionOutput: resolutionOutput, | 414 resolutionOutput: resolutionOutput, |
| 424 resolveOnly: resolveOnly, | 415 resolveOnly: resolveOnly, |
| 425 sourceMapUri: sourceMapUri, | 416 sourceMapUri: sourceMapUri, |
| 426 strips: strips, | 417 strips: strips, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 455 this.disableTypeInference: false, | 446 this.disableTypeInference: false, |
| 456 this.dumpInfo: false, | 447 this.dumpInfo: false, |
| 457 this.enableAssertMessage: true, | 448 this.enableAssertMessage: true, |
| 458 this.enableExperimentalMirrors: false, | 449 this.enableExperimentalMirrors: false, |
| 459 this.enableMinification: false, | 450 this.enableMinification: false, |
| 460 this.enableNativeLiveTypeAnalysis: false, | 451 this.enableNativeLiveTypeAnalysis: false, |
| 461 this.enableTypeAssertions: false, | 452 this.enableTypeAssertions: false, |
| 462 this.enableUserAssertions: false, | 453 this.enableUserAssertions: false, |
| 463 this.generateCodeWithCompileTimeErrors: false, | 454 this.generateCodeWithCompileTimeErrors: false, |
| 464 this.generateSourceMap: true, | 455 this.generateSourceMap: true, |
| 465 this.hasIncrementalSupport: false, | |
| 466 this.outputUri: null, | 456 this.outputUri: null, |
| 467 this.platformConfigUri: null, | 457 this.platformConfigUri: null, |
| 468 this.preserveComments: false, | 458 this.preserveComments: false, |
| 469 this.preserveUris: false, | 459 this.preserveUris: false, |
| 470 this.resolutionInputs: null, | 460 this.resolutionInputs: null, |
| 471 this.resolutionOutput: null, | 461 this.resolutionOutput: null, |
| 472 this.resolveOnly: false, | 462 this.resolveOnly: false, |
| 473 this.compileOnly: false, | 463 this.compileOnly: false, |
| 474 this.sourceMapUri: null, | 464 this.sourceMapUri: null, |
| 475 this.strips: const [], | 465 this.strips: const [], |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 disableTypeInference, | 501 disableTypeInference, |
| 512 dumpInfo, | 502 dumpInfo, |
| 513 enableAssertMessage, | 503 enableAssertMessage, |
| 514 enableExperimentalMirrors, | 504 enableExperimentalMirrors, |
| 515 enableMinification, | 505 enableMinification, |
| 516 enableNativeLiveTypeAnalysis, | 506 enableNativeLiveTypeAnalysis, |
| 517 enableTypeAssertions, | 507 enableTypeAssertions, |
| 518 enableUserAssertions, | 508 enableUserAssertions, |
| 519 generateCodeWithCompileTimeErrors, | 509 generateCodeWithCompileTimeErrors, |
| 520 generateSourceMap, | 510 generateSourceMap, |
| 521 hasIncrementalSupport, | |
| 522 outputUri, | 511 outputUri, |
| 523 platformConfigUri, | 512 platformConfigUri, |
| 524 preserveComments, | 513 preserveComments, |
| 525 preserveUris, | 514 preserveUris, |
| 526 resolutionInputs, | 515 resolutionInputs, |
| 527 resolutionOutput, | 516 resolutionOutput, |
| 528 resolveOnly, | 517 resolveOnly, |
| 529 compileOnly, | 518 compileOnly, |
| 530 sourceMapUri, | 519 sourceMapUri, |
| 531 strips, | 520 strips, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 enableMinification: enableMinification ?? options.enableMinification, | 562 enableMinification: enableMinification ?? options.enableMinification, |
| 574 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? | 563 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? |
| 575 options.enableNativeLiveTypeAnalysis, | 564 options.enableNativeLiveTypeAnalysis, |
| 576 enableTypeAssertions: | 565 enableTypeAssertions: |
| 577 enableTypeAssertions ?? options.enableTypeAssertions, | 566 enableTypeAssertions ?? options.enableTypeAssertions, |
| 578 enableUserAssertions: | 567 enableUserAssertions: |
| 579 enableUserAssertions ?? options.enableUserAssertions, | 568 enableUserAssertions ?? options.enableUserAssertions, |
| 580 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 569 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
| 581 options.generateCodeWithCompileTimeErrors, | 570 options.generateCodeWithCompileTimeErrors, |
| 582 generateSourceMap: generateSourceMap ?? options.generateSourceMap, | 571 generateSourceMap: generateSourceMap ?? options.generateSourceMap, |
| 583 hasIncrementalSupport: | |
| 584 hasIncrementalSupport ?? options.hasIncrementalSupport, | |
| 585 outputUri: outputUri ?? options.outputUri, | 572 outputUri: outputUri ?? options.outputUri, |
| 586 platformConfigUri: platformConfigUri ?? options.platformConfigUri, | 573 platformConfigUri: platformConfigUri ?? options.platformConfigUri, |
| 587 preserveComments: preserveComments ?? options.preserveComments, | 574 preserveComments: preserveComments ?? options.preserveComments, |
| 588 preserveUris: preserveUris ?? options.preserveUris, | 575 preserveUris: preserveUris ?? options.preserveUris, |
| 589 resolutionInputs: resolutionInputs ?? options.resolutionInputs, | 576 resolutionInputs: resolutionInputs ?? options.resolutionInputs, |
| 590 resolutionOutput: resolutionOutput ?? options.resolutionOutput, | 577 resolutionOutput: resolutionOutput ?? options.resolutionOutput, |
| 591 resolveOnly: resolveOnly ?? options.resolveOnly, | 578 resolveOnly: resolveOnly ?? options.resolveOnly, |
| 592 compileOnly: compileOnly ?? options.compileOnly, | 579 compileOnly: compileOnly ?? options.compileOnly, |
| 593 sourceMapUri: sourceMapUri ?? options.sourceMapUri, | 580 sourceMapUri: sourceMapUri ?? options.sourceMapUri, |
| 594 strips: strips ?? options.strips, | 581 strips: strips ?? options.strips, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 _extractStringOption(options, "--platform-config=", null), | 686 _extractStringOption(options, "--platform-config=", null), |
| 700 _extractCsvOption(options, '--categories=')); | 687 _extractCsvOption(options, '--categories=')); |
| 701 } | 688 } |
| 702 | 689 |
| 703 /// Locations of the platform descriptor files relative to the library root. | 690 /// Locations of the platform descriptor files relative to the library root. |
| 704 const String _clientPlatform = "lib/dart_client.platform"; | 691 const String _clientPlatform = "lib/dart_client.platform"; |
| 705 const String _serverPlatform = "lib/dart_server.platform"; | 692 const String _serverPlatform = "lib/dart_server.platform"; |
| 706 const String _sharedPlatform = "lib/dart_shared.platform"; | 693 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 707 | 694 |
| 708 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 695 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| 709 const bool _forceIncrementalSupport = | |
| 710 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | |
| OLD | NEW |