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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 132 /// Whether we allow passing an extra argument to `assert`, containing a |
133 /// reason for why an assertion fails. (experimental) | 133 /// reason for why an assertion fails. (experimental) |
134 final bool enableAssertMessage; | 134 final bool enableAssertMessage; |
135 | 135 |
136 /// Support access to initializing formal constructor arguments, e.g., the | |
137 /// use of `x` to initialize `y` in `C(this.x) : y = x`. | |
138 final bool enableInitializingFormalAccess; | |
139 | |
140 /// Whether the user specified a flag to allow the use of dart:mirrors. This | 136 /// Whether the user specified a flag to allow the use of dart:mirrors. This |
141 /// silences a warning produced by the compiler. | 137 /// silences a warning produced by the compiler. |
142 final bool enableExperimentalMirrors; | 138 final bool enableExperimentalMirrors; |
143 | 139 |
144 /// Whether to enable minification | 140 /// Whether to enable minification |
145 // TODO(sigmund): rename to minify | 141 // TODO(sigmund): rename to minify |
146 final bool enableMinification; | 142 final bool enableMinification; |
147 | 143 |
148 /// Whether to model which native classes are live based on annotations on the | 144 /// Whether to model which native classes are live based on annotations on the |
149 /// core libraries. If false, all native classes will be included by default. | 145 /// core libraries. If false, all native classes will be included by default. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 fatalWarnings: _hasOption(options, Flags.fatalWarnings), | 261 fatalWarnings: _hasOption(options, Flags.fatalWarnings), |
266 terseDiagnostics: _hasOption(options, Flags.terse), | 262 terseDiagnostics: _hasOption(options, Flags.terse), |
267 suppressWarnings: _hasOption(options, Flags.suppressWarnings), | 263 suppressWarnings: _hasOption(options, Flags.suppressWarnings), |
268 suppressHints: _hasOption(options, Flags.suppressHints), | 264 suppressHints: _hasOption(options, Flags.suppressHints), |
269 shownPackageWarnings: | 265 shownPackageWarnings: |
270 _extractOptionalCsvOption(options, Flags.showPackageWarnings), | 266 _extractOptionalCsvOption(options, Flags.showPackageWarnings), |
271 disableInlining: _hasOption(options, Flags.disableInlining), | 267 disableInlining: _hasOption(options, Flags.disableInlining), |
272 disableTypeInference: _hasOption(options, Flags.disableTypeInference), | 268 disableTypeInference: _hasOption(options, Flags.disableTypeInference), |
273 dumpInfo: _hasOption(options, Flags.dumpInfo), | 269 dumpInfo: _hasOption(options, Flags.dumpInfo), |
274 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), | 270 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), |
275 enableInitializingFormalAccess: | |
276 _hasOption(options, Flags.initializingFormalAccess), | |
277 enableExperimentalMirrors: | 271 enableExperimentalMirrors: |
278 _hasOption(options, Flags.enableExperimentalMirrors), | 272 _hasOption(options, Flags.enableExperimentalMirrors), |
279 enableMinification: _hasOption(options, Flags.minify), | 273 enableMinification: _hasOption(options, Flags.minify), |
280 enableNativeLiveTypeAnalysis: | 274 enableNativeLiveTypeAnalysis: |
281 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 275 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
282 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 276 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
283 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 277 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
284 generateCodeWithCompileTimeErrors: | 278 generateCodeWithCompileTimeErrors: |
285 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 279 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
286 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 280 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 Uri deferredMapUri: null, | 327 Uri deferredMapUri: null, |
334 bool fatalWarnings: false, | 328 bool fatalWarnings: false, |
335 bool terseDiagnostics: false, | 329 bool terseDiagnostics: false, |
336 bool suppressWarnings: false, | 330 bool suppressWarnings: false, |
337 bool suppressHints: false, | 331 bool suppressHints: false, |
338 List<String> shownPackageWarnings: null, | 332 List<String> shownPackageWarnings: null, |
339 bool disableInlining: false, | 333 bool disableInlining: false, |
340 bool disableTypeInference: false, | 334 bool disableTypeInference: false, |
341 bool dumpInfo: false, | 335 bool dumpInfo: false, |
342 bool enableAssertMessage: false, | 336 bool enableAssertMessage: false, |
343 bool enableInitializingFormalAccess: false, | |
344 bool enableExperimentalMirrors: false, | 337 bool enableExperimentalMirrors: false, |
345 bool enableMinification: false, | 338 bool enableMinification: false, |
346 bool enableNativeLiveTypeAnalysis: true, | 339 bool enableNativeLiveTypeAnalysis: true, |
347 bool enableTypeAssertions: false, | 340 bool enableTypeAssertions: false, |
348 bool enableUserAssertions: false, | 341 bool enableUserAssertions: false, |
349 bool generateCodeWithCompileTimeErrors: false, | 342 bool generateCodeWithCompileTimeErrors: false, |
350 bool generateSourceMap: true, | 343 bool generateSourceMap: true, |
351 bool hasIncrementalSupport: false, | 344 bool hasIncrementalSupport: false, |
352 Uri outputUri: null, | 345 Uri outputUri: null, |
353 Uri platformConfigUri: null, | 346 Uri platformConfigUri: null, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 deferredMapUri: deferredMapUri, | 397 deferredMapUri: deferredMapUri, |
405 fatalWarnings: fatalWarnings, | 398 fatalWarnings: fatalWarnings, |
406 terseDiagnostics: terseDiagnostics, | 399 terseDiagnostics: terseDiagnostics, |
407 suppressWarnings: suppressWarnings, | 400 suppressWarnings: suppressWarnings, |
408 suppressHints: suppressHints, | 401 suppressHints: suppressHints, |
409 shownPackageWarnings: shownPackageWarnings, | 402 shownPackageWarnings: shownPackageWarnings, |
410 disableInlining: disableInlining || hasIncrementalSupport, | 403 disableInlining: disableInlining || hasIncrementalSupport, |
411 disableTypeInference: disableTypeInference, | 404 disableTypeInference: disableTypeInference, |
412 dumpInfo: dumpInfo, | 405 dumpInfo: dumpInfo, |
413 enableAssertMessage: enableAssertMessage, | 406 enableAssertMessage: enableAssertMessage, |
414 enableInitializingFormalAccess: enableInitializingFormalAccess, | |
415 enableExperimentalMirrors: enableExperimentalMirrors, | 407 enableExperimentalMirrors: enableExperimentalMirrors, |
416 enableMinification: enableMinification, | 408 enableMinification: enableMinification, |
417 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 409 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
418 enableTypeAssertions: enableTypeAssertions, | 410 enableTypeAssertions: enableTypeAssertions, |
419 enableUserAssertions: enableUserAssertions, | 411 enableUserAssertions: enableUserAssertions, |
420 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 412 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
421 generateSourceMap: generateSourceMap, | 413 generateSourceMap: generateSourceMap, |
422 hasIncrementalSupport: hasIncrementalSupport, | 414 hasIncrementalSupport: hasIncrementalSupport, |
423 outputUri: outputUri, | 415 outputUri: outputUri, |
424 platformConfigUri: platformConfigUri ?? | 416 platformConfigUri: platformConfigUri ?? |
(...skipping 29 matching lines...) Expand all Loading... |
454 this.deferredMapUri: null, | 446 this.deferredMapUri: null, |
455 this.fatalWarnings: false, | 447 this.fatalWarnings: false, |
456 this.terseDiagnostics: false, | 448 this.terseDiagnostics: false, |
457 this.suppressWarnings: false, | 449 this.suppressWarnings: false, |
458 this.suppressHints: false, | 450 this.suppressHints: false, |
459 List<String> shownPackageWarnings: null, | 451 List<String> shownPackageWarnings: null, |
460 this.disableInlining: false, | 452 this.disableInlining: false, |
461 this.disableTypeInference: false, | 453 this.disableTypeInference: false, |
462 this.dumpInfo: false, | 454 this.dumpInfo: false, |
463 this.enableAssertMessage: false, | 455 this.enableAssertMessage: false, |
464 this.enableInitializingFormalAccess: false, | |
465 this.enableExperimentalMirrors: false, | 456 this.enableExperimentalMirrors: false, |
466 this.enableMinification: false, | 457 this.enableMinification: false, |
467 this.enableNativeLiveTypeAnalysis: false, | 458 this.enableNativeLiveTypeAnalysis: false, |
468 this.enableTypeAssertions: false, | 459 this.enableTypeAssertions: false, |
469 this.enableUserAssertions: false, | 460 this.enableUserAssertions: false, |
470 this.generateCodeWithCompileTimeErrors: false, | 461 this.generateCodeWithCompileTimeErrors: false, |
471 this.generateSourceMap: true, | 462 this.generateSourceMap: true, |
472 this.hasIncrementalSupport: false, | 463 this.hasIncrementalSupport: false, |
473 this.outputUri: null, | 464 this.outputUri: null, |
474 this.platformConfigUri: null, | 465 this.platformConfigUri: null, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 deferredMapUri, | 502 deferredMapUri, |
512 fatalWarnings, | 503 fatalWarnings, |
513 terseDiagnostics, | 504 terseDiagnostics, |
514 suppressWarnings, | 505 suppressWarnings, |
515 suppressHints, | 506 suppressHints, |
516 List<String> shownPackageWarnings, | 507 List<String> shownPackageWarnings, |
517 disableInlining, | 508 disableInlining, |
518 disableTypeInference, | 509 disableTypeInference, |
519 dumpInfo, | 510 dumpInfo, |
520 enableAssertMessage, | 511 enableAssertMessage, |
521 enableInitializingFormalAccess, | |
522 enableExperimentalMirrors, | 512 enableExperimentalMirrors, |
523 enableMinification, | 513 enableMinification, |
524 enableNativeLiveTypeAnalysis, | 514 enableNativeLiveTypeAnalysis, |
525 enableTypeAssertions, | 515 enableTypeAssertions, |
526 enableUserAssertions, | 516 enableUserAssertions, |
527 generateCodeWithCompileTimeErrors, | 517 generateCodeWithCompileTimeErrors, |
528 generateSourceMap, | 518 generateSourceMap, |
529 hasIncrementalSupport, | 519 hasIncrementalSupport, |
530 outputUri, | 520 outputUri, |
531 platformConfigUri, | 521 platformConfigUri, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 terseDiagnostics: terseDiagnostics ?? options.terseDiagnostics, | 559 terseDiagnostics: terseDiagnostics ?? options.terseDiagnostics, |
570 suppressWarnings: suppressWarnings ?? options.suppressWarnings, | 560 suppressWarnings: suppressWarnings ?? options.suppressWarnings, |
571 suppressHints: suppressHints ?? options.suppressHints, | 561 suppressHints: suppressHints ?? options.suppressHints, |
572 shownPackageWarnings: | 562 shownPackageWarnings: |
573 shownPackageWarnings ?? options._shownPackageWarnings, | 563 shownPackageWarnings ?? options._shownPackageWarnings, |
574 disableInlining: disableInlining ?? options.disableInlining, | 564 disableInlining: disableInlining ?? options.disableInlining, |
575 disableTypeInference: | 565 disableTypeInference: |
576 disableTypeInference ?? options.disableTypeInference, | 566 disableTypeInference ?? options.disableTypeInference, |
577 dumpInfo: dumpInfo ?? options.dumpInfo, | 567 dumpInfo: dumpInfo ?? options.dumpInfo, |
578 enableAssertMessage: enableAssertMessage ?? options.enableAssertMessage, | 568 enableAssertMessage: enableAssertMessage ?? options.enableAssertMessage, |
579 enableInitializingFormalAccess: enableInitializingFormalAccess ?? | |
580 options.enableInitializingFormalAccess, | |
581 enableExperimentalMirrors: | 569 enableExperimentalMirrors: |
582 enableExperimentalMirrors ?? options.enableExperimentalMirrors, | 570 enableExperimentalMirrors ?? options.enableExperimentalMirrors, |
583 enableMinification: enableMinification ?? options.enableMinification, | 571 enableMinification: enableMinification ?? options.enableMinification, |
584 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? | 572 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis ?? |
585 options.enableNativeLiveTypeAnalysis, | 573 options.enableNativeLiveTypeAnalysis, |
586 enableTypeAssertions: | 574 enableTypeAssertions: |
587 enableTypeAssertions ?? options.enableTypeAssertions, | 575 enableTypeAssertions ?? options.enableTypeAssertions, |
588 enableUserAssertions: | 576 enableUserAssertions: |
589 enableUserAssertions ?? options.enableUserAssertions, | 577 enableUserAssertions ?? options.enableUserAssertions, |
590 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? | 578 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors ?? |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 699 } |
712 | 700 |
713 /// Locations of the platform descriptor files relative to the library root. | 701 /// Locations of the platform descriptor files relative to the library root. |
714 const String _clientPlatform = "lib/dart_client.platform"; | 702 const String _clientPlatform = "lib/dart_client.platform"; |
715 const String _serverPlatform = "lib/dart_server.platform"; | 703 const String _serverPlatform = "lib/dart_server.platform"; |
716 const String _sharedPlatform = "lib/dart_shared.platform"; | 704 const String _sharedPlatform = "lib/dart_shared.platform"; |
717 | 705 |
718 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 706 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
719 const bool _forceIncrementalSupport = | 707 const bool _forceIncrementalSupport = |
720 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | 708 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
OLD | NEW |