| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 /// Whether to disable global type inference. | 123 /// Whether to disable global type inference. |
| 124 final bool disableTypeInference; | 124 final bool disableTypeInference; |
| 125 | 125 |
| 126 /// Whether to emit a .json file with a summary of the information used by the | 126 /// Whether to emit a .json file with a summary of the information used by the |
| 127 /// compiler during optimization. This includes resolution details, | 127 /// compiler during optimization. This includes resolution details, |
| 128 /// dependencies between elements, results of type inference, and the output | 128 /// dependencies between elements, results of type inference, and the output |
| 129 /// code for each function. | 129 /// code for each function. |
| 130 final bool dumpInfo; | 130 final bool dumpInfo; |
| 131 | 131 |
| 132 /// Whether we allow passing an extra argument to `assert`, containing a | |
| 133 /// reason for why an assertion fails. (experimental) | |
| 134 final bool enableAssertMessage; | |
| 135 | |
| 136 /// Whether the user specified a flag to allow the use of dart:mirrors. This | 132 /// Whether the user specified a flag to allow the use of dart:mirrors. This |
| 137 /// silences a warning produced by the compiler. | 133 /// silences a warning produced by the compiler. |
| 138 final bool enableExperimentalMirrors; | 134 final bool enableExperimentalMirrors; |
| 139 | 135 |
| 140 /// Whether to enable minification | 136 /// Whether to enable minification |
| 141 // TODO(sigmund): rename to minify | 137 // TODO(sigmund): rename to minify |
| 142 final bool enableMinification; | 138 final bool enableMinification; |
| 143 | 139 |
| 144 /// Whether to model which native classes are live based on annotations on the | 140 /// Whether to model which native classes are live based on annotations on the |
| 145 /// core libraries. If false, all native classes will be included by default. | 141 /// core libraries. If false, all native classes will be included by default. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 deferredMapUri: _extractUriOption(options, '--deferred-map='), | 256 deferredMapUri: _extractUriOption(options, '--deferred-map='), |
| 261 fatalWarnings: _hasOption(options, Flags.fatalWarnings), | 257 fatalWarnings: _hasOption(options, Flags.fatalWarnings), |
| 262 terseDiagnostics: _hasOption(options, Flags.terse), | 258 terseDiagnostics: _hasOption(options, Flags.terse), |
| 263 suppressWarnings: _hasOption(options, Flags.suppressWarnings), | 259 suppressWarnings: _hasOption(options, Flags.suppressWarnings), |
| 264 suppressHints: _hasOption(options, Flags.suppressHints), | 260 suppressHints: _hasOption(options, Flags.suppressHints), |
| 265 shownPackageWarnings: | 261 shownPackageWarnings: |
| 266 _extractOptionalCsvOption(options, Flags.showPackageWarnings), | 262 _extractOptionalCsvOption(options, Flags.showPackageWarnings), |
| 267 disableInlining: _hasOption(options, Flags.disableInlining), | 263 disableInlining: _hasOption(options, Flags.disableInlining), |
| 268 disableTypeInference: _hasOption(options, Flags.disableTypeInference), | 264 disableTypeInference: _hasOption(options, Flags.disableTypeInference), |
| 269 dumpInfo: _hasOption(options, Flags.dumpInfo), | 265 dumpInfo: _hasOption(options, Flags.dumpInfo), |
| 270 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), | |
| 271 enableExperimentalMirrors: | 266 enableExperimentalMirrors: |
| 272 _hasOption(options, Flags.enableExperimentalMirrors), | 267 _hasOption(options, Flags.enableExperimentalMirrors), |
| 273 enableMinification: _hasOption(options, Flags.minify), | 268 enableMinification: _hasOption(options, Flags.minify), |
| 274 enableNativeLiveTypeAnalysis: | 269 enableNativeLiveTypeAnalysis: |
| 275 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 270 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
| 276 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 271 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 277 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 272 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 278 generateCodeWithCompileTimeErrors: | 273 generateCodeWithCompileTimeErrors: |
| 279 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 274 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 280 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 275 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 String buildId: _UNDETERMINED_BUILD_ID, | 321 String buildId: _UNDETERMINED_BUILD_ID, |
| 327 Uri deferredMapUri: null, | 322 Uri deferredMapUri: null, |
| 328 bool fatalWarnings: false, | 323 bool fatalWarnings: false, |
| 329 bool terseDiagnostics: false, | 324 bool terseDiagnostics: false, |
| 330 bool suppressWarnings: false, | 325 bool suppressWarnings: false, |
| 331 bool suppressHints: false, | 326 bool suppressHints: false, |
| 332 List<String> shownPackageWarnings: null, | 327 List<String> shownPackageWarnings: null, |
| 333 bool disableInlining: false, | 328 bool disableInlining: false, |
| 334 bool disableTypeInference: false, | 329 bool disableTypeInference: false, |
| 335 bool dumpInfo: false, | 330 bool dumpInfo: false, |
| 336 bool enableAssertMessage: false, | |
| 337 bool enableExperimentalMirrors: false, | 331 bool enableExperimentalMirrors: false, |
| 338 bool enableMinification: false, | 332 bool enableMinification: false, |
| 339 bool enableNativeLiveTypeAnalysis: true, | 333 bool enableNativeLiveTypeAnalysis: true, |
| 340 bool enableTypeAssertions: false, | 334 bool enableTypeAssertions: false, |
| 341 bool enableUserAssertions: false, | 335 bool enableUserAssertions: false, |
| 342 bool generateCodeWithCompileTimeErrors: false, | 336 bool generateCodeWithCompileTimeErrors: false, |
| 343 bool generateSourceMap: true, | 337 bool generateSourceMap: true, |
| 344 bool hasIncrementalSupport: false, | 338 bool hasIncrementalSupport: false, |
| 345 Uri outputUri: null, | 339 Uri outputUri: null, |
| 346 Uri platformConfigUri: null, | 340 Uri platformConfigUri: null, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 buildId: buildId, | 390 buildId: buildId, |
| 397 deferredMapUri: deferredMapUri, | 391 deferredMapUri: deferredMapUri, |
| 398 fatalWarnings: fatalWarnings, | 392 fatalWarnings: fatalWarnings, |
| 399 terseDiagnostics: terseDiagnostics, | 393 terseDiagnostics: terseDiagnostics, |
| 400 suppressWarnings: suppressWarnings, | 394 suppressWarnings: suppressWarnings, |
| 401 suppressHints: suppressHints, | 395 suppressHints: suppressHints, |
| 402 shownPackageWarnings: shownPackageWarnings, | 396 shownPackageWarnings: shownPackageWarnings, |
| 403 disableInlining: disableInlining || hasIncrementalSupport, | 397 disableInlining: disableInlining || hasIncrementalSupport, |
| 404 disableTypeInference: disableTypeInference, | 398 disableTypeInference: disableTypeInference, |
| 405 dumpInfo: dumpInfo, | 399 dumpInfo: dumpInfo, |
| 406 enableAssertMessage: enableAssertMessage, | |
| 407 enableExperimentalMirrors: enableExperimentalMirrors, | 400 enableExperimentalMirrors: enableExperimentalMirrors, |
| 408 enableMinification: enableMinification, | 401 enableMinification: enableMinification, |
| 409 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 402 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
| 410 enableTypeAssertions: enableTypeAssertions, | 403 enableTypeAssertions: enableTypeAssertions, |
| 411 enableUserAssertions: enableUserAssertions, | 404 enableUserAssertions: enableUserAssertions, |
| 412 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 405 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
| 413 generateSourceMap: generateSourceMap, | 406 generateSourceMap: generateSourceMap, |
| 414 hasIncrementalSupport: hasIncrementalSupport, | 407 hasIncrementalSupport: hasIncrementalSupport, |
| 415 outputUri: outputUri, | 408 outputUri: outputUri, |
| 416 platformConfigUri: platformConfigUri ?? | 409 platformConfigUri: platformConfigUri ?? |
| (...skipping 28 matching lines...) Expand all Loading... |
| 445 this.buildId: _UNDETERMINED_BUILD_ID, | 438 this.buildId: _UNDETERMINED_BUILD_ID, |
| 446 this.deferredMapUri: null, | 439 this.deferredMapUri: null, |
| 447 this.fatalWarnings: false, | 440 this.fatalWarnings: false, |
| 448 this.terseDiagnostics: false, | 441 this.terseDiagnostics: false, |
| 449 this.suppressWarnings: false, | 442 this.suppressWarnings: false, |
| 450 this.suppressHints: false, | 443 this.suppressHints: false, |
| 451 List<String> shownPackageWarnings: null, | 444 List<String> shownPackageWarnings: null, |
| 452 this.disableInlining: false, | 445 this.disableInlining: false, |
| 453 this.disableTypeInference: false, | 446 this.disableTypeInference: false, |
| 454 this.dumpInfo: false, | 447 this.dumpInfo: false, |
| 455 this.enableAssertMessage: false, | |
| 456 this.enableExperimentalMirrors: false, | 448 this.enableExperimentalMirrors: false, |
| 457 this.enableMinification: false, | 449 this.enableMinification: false, |
| 458 this.enableNativeLiveTypeAnalysis: false, | 450 this.enableNativeLiveTypeAnalysis: false, |
| 459 this.enableTypeAssertions: false, | 451 this.enableTypeAssertions: false, |
| 460 this.enableUserAssertions: false, | 452 this.enableUserAssertions: false, |
| 461 this.generateCodeWithCompileTimeErrors: false, | 453 this.generateCodeWithCompileTimeErrors: false, |
| 462 this.generateSourceMap: true, | 454 this.generateSourceMap: true, |
| 463 this.hasIncrementalSupport: false, | 455 this.hasIncrementalSupport: false, |
| 464 this.outputUri: null, | 456 this.outputUri: null, |
| 465 this.platformConfigUri: null, | 457 this.platformConfigUri: null, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 buildId, | 493 buildId, |
| 502 deferredMapUri, | 494 deferredMapUri, |
| 503 fatalWarnings, | 495 fatalWarnings, |
| 504 terseDiagnostics, | 496 terseDiagnostics, |
| 505 suppressWarnings, | 497 suppressWarnings, |
| 506 suppressHints, | 498 suppressHints, |
| 507 List<String> shownPackageWarnings, | 499 List<String> shownPackageWarnings, |
| 508 disableInlining, | 500 disableInlining, |
| 509 disableTypeInference, | 501 disableTypeInference, |
| 510 dumpInfo, | 502 dumpInfo, |
| 511 enableAssertMessage, | |
| 512 enableExperimentalMirrors, | 503 enableExperimentalMirrors, |
| 513 enableMinification, | 504 enableMinification, |
| 514 enableNativeLiveTypeAnalysis, | 505 enableNativeLiveTypeAnalysis, |
| 515 enableTypeAssertions, | 506 enableTypeAssertions, |
| 516 enableUserAssertions, | 507 enableUserAssertions, |
| 517 generateCodeWithCompileTimeErrors, | 508 generateCodeWithCompileTimeErrors, |
| 518 generateSourceMap, | 509 generateSourceMap, |
| 519 hasIncrementalSupport, | 510 hasIncrementalSupport, |
| 520 outputUri, | 511 outputUri, |
| 521 platformConfigUri, | 512 platformConfigUri, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 fatalWarnings: fatalWarnings ?? options.fatalWarnings, | 549 fatalWarnings: fatalWarnings ?? options.fatalWarnings, |
| 559 terseDiagnostics: terseDiagnostics ?? options.terseDiagnostics, | 550 terseDiagnostics: terseDiagnostics ?? options.terseDiagnostics, |
| 560 suppressWarnings: suppressWarnings ?? options.suppressWarnings, | 551 suppressWarnings: suppressWarnings ?? options.suppressWarnings, |
| 561 suppressHints: suppressHints ?? options.suppressHints, | 552 suppressHints: suppressHints ?? options.suppressHints, |
| 562 shownPackageWarnings: | 553 shownPackageWarnings: |
| 563 shownPackageWarnings ?? options._shownPackageWarnings, | 554 shownPackageWarnings ?? options._shownPackageWarnings, |
| 564 disableInlining: disableInlining ?? options.disableInlining, | 555 disableInlining: disableInlining ?? options.disableInlining, |
| 565 disableTypeInference: | 556 disableTypeInference: |
| 566 disableTypeInference ?? options.disableTypeInference, | 557 disableTypeInference ?? options.disableTypeInference, |
| 567 dumpInfo: dumpInfo ?? options.dumpInfo, | 558 dumpInfo: dumpInfo ?? options.dumpInfo, |
| 568 enableAssertMessage: enableAssertMessage ?? options.enableAssertMessage, | |
| 569 enableExperimentalMirrors: | 559 enableExperimentalMirrors: |
| 570 enableExperimentalMirrors ?? options.enableExperimentalMirrors, | 560 enableExperimentalMirrors ?? options.enableExperimentalMirrors, |
| 571 enableMinification: enableMinification ?? options.enableMinification, | 561 enableMinification: enableMinification ?? options.enableMinification, |
| 572 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? | 562 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? |
| 573 options.enableNativeLiveTypeAnalysis, | 563 options.enableNativeLiveTypeAnalysis, |
| 574 enableTypeAssertions: | 564 enableTypeAssertions: |
| 575 enableTypeAssertions ?? options.enableTypeAssertions, | 565 enableTypeAssertions ?? options.enableTypeAssertions, |
| 576 enableUserAssertions: | 566 enableUserAssertions: |
| 577 enableUserAssertions ?? options.enableUserAssertions, | 567 enableUserAssertions ?? options.enableUserAssertions, |
| 578 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 568 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 689 } |
| 700 | 690 |
| 701 /// Locations of the platform descriptor files relative to the library root. | 691 /// Locations of the platform descriptor files relative to the library root. |
| 702 const String _clientPlatform = "lib/dart_client.platform"; | 692 const String _clientPlatform = "lib/dart_client.platform"; |
| 703 const String _serverPlatform = "lib/dart_server.platform"; | 693 const String _serverPlatform = "lib/dart_server.platform"; |
| 704 const String _sharedPlatform = "lib/dart_shared.platform"; | 694 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 705 | 695 |
| 706 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 696 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| 707 const bool _forceIncrementalSupport = | 697 const bool _forceIncrementalSupport = |
| 708 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | 698 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
| OLD | NEW |