| 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 'commandline_options.dart' show Flags; | 7 import 'commandline_options.dart' show Flags; |
| 8 import '../compiler.dart' show PackagesDiscoveryProvider; | 8 import '../compiler.dart' show PackagesDiscoveryProvider; |
| 9 | 9 |
| 10 /// Options used for parsing. | 10 /// Options used for parsing. |
| 11 /// | 11 /// |
| 12 /// Use this to conditionally support certain constructs, e.g., | 12 /// Use this to conditionally support certain constructs, e.g., |
| 13 /// experimental ones. | 13 /// experimental ones. |
| 14 abstract class ParserOptions { | 14 abstract class ParserOptions { |
| 15 const ParserOptions(); | 15 const ParserOptions(); |
| 16 | 16 |
| 17 /// Support conditional directives, e.g., configurable imports. | 17 /// Support conditional directives, e.g., configurable imports. |
| 18 bool get enableConditionalDirectives; | 18 bool get enableConditionalDirectives; |
| 19 |
| 20 /// Support parsing of generic method declarations, and invocations of |
| 21 /// methods where type arguments are passed. |
| 22 bool get enableGenericMethodSyntax; |
| 19 } | 23 } |
| 20 | 24 |
| 21 /// Options used for controlling diagnostic messages. | 25 /// Options used for controlling diagnostic messages. |
| 22 abstract class DiagnosticOptions { | 26 abstract class DiagnosticOptions { |
| 23 const DiagnosticOptions(); | 27 const DiagnosticOptions(); |
| 24 | 28 |
| 25 /// If `true`, warnings cause the compilation to fail. | 29 /// If `true`, warnings cause the compilation to fail. |
| 26 bool get fatalWarnings; | 30 bool get fatalWarnings; |
| 27 | 31 |
| 28 /// Emit terse diagnostics without howToFix. | 32 /// Emit terse diagnostics without howToFix. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 /// code for each function. | 144 /// code for each function. |
| 141 final bool dumpInfo; | 145 final bool dumpInfo; |
| 142 | 146 |
| 143 /// Whether we allow passing an extra argument to `assert`, containing a | 147 /// Whether we allow passing an extra argument to `assert`, containing a |
| 144 /// reason for why an assertion fails. (experimental) | 148 /// reason for why an assertion fails. (experimental) |
| 145 final bool enableAssertMessage; | 149 final bool enableAssertMessage; |
| 146 | 150 |
| 147 /// Whether to enable the experimental conditional directives feature. | 151 /// Whether to enable the experimental conditional directives feature. |
| 148 final bool enableConditionalDirectives; | 152 final bool enableConditionalDirectives; |
| 149 | 153 |
| 154 /// Support parsing of generic method declarations, and invocations of |
| 155 /// methods where type arguments are passed. |
| 156 final bool enableGenericMethodSyntax; |
| 157 |
| 150 /// Whether the user specified a flag to allow the use of dart:mirrors. This | 158 /// Whether the user specified a flag to allow the use of dart:mirrors. This |
| 151 /// silences a warning produced by the compiler. | 159 /// silences a warning produced by the compiler. |
| 152 final bool enableExperimentalMirrors; | 160 final bool enableExperimentalMirrors; |
| 153 | 161 |
| 154 /// Whether to enable minification | 162 /// Whether to enable minification |
| 155 // TODO(sigmund): rename to minify | 163 // TODO(sigmund): rename to minify |
| 156 final bool enableMinification; | 164 final bool enableMinification; |
| 157 | 165 |
| 158 /// Whether to model which native classes are live based on annotations on the | 166 /// Whether to model which native classes are live based on annotations on the |
| 159 /// core libraries. If false, all native classes will be included by default. | 167 /// core libraries. If false, all native classes will be included by default. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 shownPackageWarnings: | 280 shownPackageWarnings: |
| 273 _extractOptionalCsvOption(options, Flags.showPackageWarnings), | 281 _extractOptionalCsvOption(options, Flags.showPackageWarnings), |
| 274 disableInlining: _hasOption(options, Flags.disableInlining), | 282 disableInlining: _hasOption(options, Flags.disableInlining), |
| 275 disableTypeInference: _hasOption(options, Flags.disableTypeInference), | 283 disableTypeInference: _hasOption(options, Flags.disableTypeInference), |
| 276 dumpInfo: _hasOption(options, Flags.dumpInfo), | 284 dumpInfo: _hasOption(options, Flags.dumpInfo), |
| 277 emitJavaScript: !(_hasOption(options, '--output-type=dart') || | 285 emitJavaScript: !(_hasOption(options, '--output-type=dart') || |
| 278 _hasOption(options, '--output-type=dart-multi')), | 286 _hasOption(options, '--output-type=dart-multi')), |
| 279 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), | 287 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), |
| 280 enableConditionalDirectives: | 288 enableConditionalDirectives: |
| 281 _hasOption(options, Flags.conditionalDirectives), | 289 _hasOption(options, Flags.conditionalDirectives), |
| 290 enableGenericMethodSyntax: |
| 291 _hasOption(options, Flags.genericMethodSyntax), |
| 282 enableExperimentalMirrors: | 292 enableExperimentalMirrors: |
| 283 _hasOption(options, Flags.enableExperimentalMirrors), | 293 _hasOption(options, Flags.enableExperimentalMirrors), |
| 284 enableMinification: _hasOption(options, Flags.minify), | 294 enableMinification: _hasOption(options, Flags.minify), |
| 285 enableNativeLiveTypeAnalysis: | 295 enableNativeLiveTypeAnalysis: |
| 286 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 296 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
| 287 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 297 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 288 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 298 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
| 289 generateCodeWithCompileTimeErrors: | 299 generateCodeWithCompileTimeErrors: |
| 290 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 300 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 291 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 301 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 bool terseDiagnostics: false, | 348 bool terseDiagnostics: false, |
| 339 bool suppressWarnings: false, | 349 bool suppressWarnings: false, |
| 340 bool suppressHints: false, | 350 bool suppressHints: false, |
| 341 List<String> shownPackageWarnings: null, | 351 List<String> shownPackageWarnings: null, |
| 342 bool disableInlining: false, | 352 bool disableInlining: false, |
| 343 bool disableTypeInference: false, | 353 bool disableTypeInference: false, |
| 344 bool dumpInfo: false, | 354 bool dumpInfo: false, |
| 345 bool emitJavaScript: true, | 355 bool emitJavaScript: true, |
| 346 bool enableAssertMessage: false, | 356 bool enableAssertMessage: false, |
| 347 bool enableConditionalDirectives: false, | 357 bool enableConditionalDirectives: false, |
| 358 bool enableGenericMethodSyntax: false, |
| 348 bool enableExperimentalMirrors: false, | 359 bool enableExperimentalMirrors: false, |
| 349 bool enableMinification: false, | 360 bool enableMinification: false, |
| 350 bool enableNativeLiveTypeAnalysis: true, | 361 bool enableNativeLiveTypeAnalysis: true, |
| 351 bool enableTypeAssertions: false, | 362 bool enableTypeAssertions: false, |
| 352 bool enableUserAssertions: false, | 363 bool enableUserAssertions: false, |
| 353 bool generateCodeWithCompileTimeErrors: false, | 364 bool generateCodeWithCompileTimeErrors: false, |
| 354 bool generateSourceMap: true, | 365 bool generateSourceMap: true, |
| 355 bool hasIncrementalSupport: false, | 366 bool hasIncrementalSupport: false, |
| 356 Uri outputUri: null, | 367 Uri outputUri: null, |
| 357 Uri platformConfigUri: null, | 368 Uri platformConfigUri: null, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 terseDiagnostics: terseDiagnostics, | 418 terseDiagnostics: terseDiagnostics, |
| 408 suppressWarnings: suppressWarnings, | 419 suppressWarnings: suppressWarnings, |
| 409 suppressHints: suppressHints, | 420 suppressHints: suppressHints, |
| 410 shownPackageWarnings: shownPackageWarnings, | 421 shownPackageWarnings: shownPackageWarnings, |
| 411 disableInlining: disableInlining || hasIncrementalSupport, | 422 disableInlining: disableInlining || hasIncrementalSupport, |
| 412 disableTypeInference: disableTypeInference || !emitJavaScript, | 423 disableTypeInference: disableTypeInference || !emitJavaScript, |
| 413 dumpInfo: dumpInfo, | 424 dumpInfo: dumpInfo, |
| 414 emitJavaScript: emitJavaScript, | 425 emitJavaScript: emitJavaScript, |
| 415 enableAssertMessage: enableAssertMessage, | 426 enableAssertMessage: enableAssertMessage, |
| 416 enableConditionalDirectives: enableConditionalDirectives, | 427 enableConditionalDirectives: enableConditionalDirectives, |
| 428 enableGenericMethodSyntax: enableGenericMethodSyntax, |
| 417 enableExperimentalMirrors: enableExperimentalMirrors, | 429 enableExperimentalMirrors: enableExperimentalMirrors, |
| 418 enableMinification: enableMinification, | 430 enableMinification: enableMinification, |
| 419 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 431 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
| 420 enableTypeAssertions: enableTypeAssertions, | 432 enableTypeAssertions: enableTypeAssertions, |
| 421 enableUserAssertions: enableUserAssertions, | 433 enableUserAssertions: enableUserAssertions, |
| 422 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 434 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
| 423 generateSourceMap: generateSourceMap, | 435 generateSourceMap: generateSourceMap, |
| 424 hasIncrementalSupport: hasIncrementalSupport, | 436 hasIncrementalSupport: hasIncrementalSupport, |
| 425 outputUri: outputUri, | 437 outputUri: outputUri, |
| 426 platformConfigUri: platformConfigUri ?? | 438 platformConfigUri: platformConfigUri ?? |
| (...skipping 30 matching lines...) Expand all Loading... |
| 457 this.terseDiagnostics: false, | 469 this.terseDiagnostics: false, |
| 458 this.suppressWarnings: false, | 470 this.suppressWarnings: false, |
| 459 this.suppressHints: false, | 471 this.suppressHints: false, |
| 460 List<String> shownPackageWarnings: null, | 472 List<String> shownPackageWarnings: null, |
| 461 this.disableInlining: false, | 473 this.disableInlining: false, |
| 462 this.disableTypeInference: false, | 474 this.disableTypeInference: false, |
| 463 this.dumpInfo: false, | 475 this.dumpInfo: false, |
| 464 this.emitJavaScript: true, | 476 this.emitJavaScript: true, |
| 465 this.enableAssertMessage: false, | 477 this.enableAssertMessage: false, |
| 466 this.enableConditionalDirectives: false, | 478 this.enableConditionalDirectives: false, |
| 479 this.enableGenericMethodSyntax: false, |
| 467 this.enableExperimentalMirrors: false, | 480 this.enableExperimentalMirrors: false, |
| 468 this.enableMinification: false, | 481 this.enableMinification: false, |
| 469 this.enableNativeLiveTypeAnalysis: false, | 482 this.enableNativeLiveTypeAnalysis: false, |
| 470 this.enableTypeAssertions: false, | 483 this.enableTypeAssertions: false, |
| 471 this.enableUserAssertions: false, | 484 this.enableUserAssertions: false, |
| 472 this.generateCodeWithCompileTimeErrors: false, | 485 this.generateCodeWithCompileTimeErrors: false, |
| 473 this.generateSourceMap: true, | 486 this.generateSourceMap: true, |
| 474 this.hasIncrementalSupport: false, | 487 this.hasIncrementalSupport: false, |
| 475 this.outputUri: null, | 488 this.outputUri: null, |
| 476 this.platformConfigUri: null, | 489 this.platformConfigUri: null, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 601 |
| 589 /// Locations of the platform descriptor files relative to the library root. | 602 /// Locations of the platform descriptor files relative to the library root. |
| 590 const String _clientPlatform = "lib/dart_client.platform"; | 603 const String _clientPlatform = "lib/dart_client.platform"; |
| 591 const String _serverPlatform = "lib/dart_server.platform"; | 604 const String _serverPlatform = "lib/dart_server.platform"; |
| 592 const String _sharedPlatform = "lib/dart_shared.platform"; | 605 const String _sharedPlatform = "lib/dart_shared.platform"; |
| 593 const String _dart2dartPlatform = "lib/dart2dart.platform"; | 606 const String _dart2dartPlatform = "lib/dart2dart.platform"; |
| 594 | 607 |
| 595 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 608 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
| 596 const bool _forceIncrementalSupport = | 609 const bool _forceIncrementalSupport = |
| 597 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | 610 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
| OLD | NEW |