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. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 final bool dumpInfo; | 142 final bool dumpInfo; |
143 | 143 |
144 /// Whether we allow passing an extra argument to `assert`, containing a | 144 /// Whether we allow passing an extra argument to `assert`, containing a |
145 /// reason for why an assertion fails. (experimental) | 145 /// reason for why an assertion fails. (experimental) |
146 final bool enableAssertMessage; | 146 final bool enableAssertMessage; |
147 | 147 |
148 /// Support parsing of generic method declarations, and invocations of | 148 /// Support parsing of generic method declarations, and invocations of |
149 /// methods where type arguments are passed. | 149 /// methods where type arguments are passed. |
150 final bool enableGenericMethodSyntax; | 150 final bool enableGenericMethodSyntax; |
151 | 151 |
| 152 /// Support access to initializing formal constructor arguments, e.g., the |
| 153 /// use of `x` to initialize `y` in `C(this.x) : y = x`. |
| 154 final bool enableInitializingFormalAccess; |
| 155 |
152 /// Whether the user specified a flag to allow the use of dart:mirrors. This | 156 /// Whether the user specified a flag to allow the use of dart:mirrors. This |
153 /// silences a warning produced by the compiler. | 157 /// silences a warning produced by the compiler. |
154 final bool enableExperimentalMirrors; | 158 final bool enableExperimentalMirrors; |
155 | 159 |
156 /// Whether to enable minification | 160 /// Whether to enable minification |
157 // TODO(sigmund): rename to minify | 161 // TODO(sigmund): rename to minify |
158 final bool enableMinification; | 162 final bool enableMinification; |
159 | 163 |
160 /// Whether to model which native classes are live based on annotations on the | 164 /// Whether to model which native classes are live based on annotations on the |
161 /// core libraries. If false, all native classes will be included by default. | 165 /// core libraries. If false, all native classes will be included by default. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 shownPackageWarnings: | 289 shownPackageWarnings: |
286 _extractOptionalCsvOption(options, Flags.showPackageWarnings), | 290 _extractOptionalCsvOption(options, Flags.showPackageWarnings), |
287 disableInlining: _hasOption(options, Flags.disableInlining), | 291 disableInlining: _hasOption(options, Flags.disableInlining), |
288 disableTypeInference: _hasOption(options, Flags.disableTypeInference), | 292 disableTypeInference: _hasOption(options, Flags.disableTypeInference), |
289 dumpInfo: _hasOption(options, Flags.dumpInfo), | 293 dumpInfo: _hasOption(options, Flags.dumpInfo), |
290 emitJavaScript: !(_hasOption(options, '--output-type=dart') || | 294 emitJavaScript: !(_hasOption(options, '--output-type=dart') || |
291 _hasOption(options, '--output-type=dart-multi')), | 295 _hasOption(options, '--output-type=dart-multi')), |
292 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), | 296 enableAssertMessage: _hasOption(options, Flags.enableAssertMessage), |
293 enableGenericMethodSyntax: | 297 enableGenericMethodSyntax: |
294 _hasOption(options, Flags.genericMethodSyntax), | 298 _hasOption(options, Flags.genericMethodSyntax), |
| 299 enableInitializingFormalAccess: |
| 300 _hasOption(options, Flags.initializingFormalAccess), |
295 enableExperimentalMirrors: | 301 enableExperimentalMirrors: |
296 _hasOption(options, Flags.enableExperimentalMirrors), | 302 _hasOption(options, Flags.enableExperimentalMirrors), |
297 enableMinification: _hasOption(options, Flags.minify), | 303 enableMinification: _hasOption(options, Flags.minify), |
298 enableNativeLiveTypeAnalysis: | 304 enableNativeLiveTypeAnalysis: |
299 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), | 305 !_hasOption(options, Flags.disableNativeLiveTypeAnalysis), |
300 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), | 306 enableTypeAssertions: _hasOption(options, Flags.enableCheckedMode), |
301 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), | 307 enableUserAssertions: _hasOption(options, Flags.enableCheckedMode), |
302 generateCodeWithCompileTimeErrors: | 308 generateCodeWithCompileTimeErrors: |
303 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 309 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
304 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), | 310 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 bool terseDiagnostics: false, | 360 bool terseDiagnostics: false, |
355 bool suppressWarnings: false, | 361 bool suppressWarnings: false, |
356 bool suppressHints: false, | 362 bool suppressHints: false, |
357 List<String> shownPackageWarnings: null, | 363 List<String> shownPackageWarnings: null, |
358 bool disableInlining: false, | 364 bool disableInlining: false, |
359 bool disableTypeInference: false, | 365 bool disableTypeInference: false, |
360 bool dumpInfo: false, | 366 bool dumpInfo: false, |
361 bool emitJavaScript: true, | 367 bool emitJavaScript: true, |
362 bool enableAssertMessage: false, | 368 bool enableAssertMessage: false, |
363 bool enableGenericMethodSyntax: false, | 369 bool enableGenericMethodSyntax: false, |
| 370 bool enableInitializingFormalAccess: false, |
364 bool enableExperimentalMirrors: false, | 371 bool enableExperimentalMirrors: false, |
365 bool enableMinification: false, | 372 bool enableMinification: false, |
366 bool enableNativeLiveTypeAnalysis: true, | 373 bool enableNativeLiveTypeAnalysis: true, |
367 bool enableTypeAssertions: false, | 374 bool enableTypeAssertions: false, |
368 bool enableUserAssertions: false, | 375 bool enableUserAssertions: false, |
369 bool generateCodeWithCompileTimeErrors: false, | 376 bool generateCodeWithCompileTimeErrors: false, |
370 bool generateSourceMap: true, | 377 bool generateSourceMap: true, |
371 bool hasIncrementalSupport: false, | 378 bool hasIncrementalSupport: false, |
372 Uri outputUri: null, | 379 Uri outputUri: null, |
373 Uri platformConfigUri: null, | 380 Uri platformConfigUri: null, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 terseDiagnostics: terseDiagnostics, | 434 terseDiagnostics: terseDiagnostics, |
428 suppressWarnings: suppressWarnings, | 435 suppressWarnings: suppressWarnings, |
429 suppressHints: suppressHints, | 436 suppressHints: suppressHints, |
430 shownPackageWarnings: shownPackageWarnings, | 437 shownPackageWarnings: shownPackageWarnings, |
431 disableInlining: disableInlining || hasIncrementalSupport, | 438 disableInlining: disableInlining || hasIncrementalSupport, |
432 disableTypeInference: disableTypeInference || !emitJavaScript, | 439 disableTypeInference: disableTypeInference || !emitJavaScript, |
433 dumpInfo: dumpInfo, | 440 dumpInfo: dumpInfo, |
434 emitJavaScript: emitJavaScript, | 441 emitJavaScript: emitJavaScript, |
435 enableAssertMessage: enableAssertMessage, | 442 enableAssertMessage: enableAssertMessage, |
436 enableGenericMethodSyntax: enableGenericMethodSyntax, | 443 enableGenericMethodSyntax: enableGenericMethodSyntax, |
| 444 enableInitializingFormalAccess: enableInitializingFormalAccess, |
437 enableExperimentalMirrors: enableExperimentalMirrors, | 445 enableExperimentalMirrors: enableExperimentalMirrors, |
438 enableMinification: enableMinification, | 446 enableMinification: enableMinification, |
439 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, | 447 enableNativeLiveTypeAnalysis: enableNativeLiveTypeAnalysis, |
440 enableTypeAssertions: enableTypeAssertions, | 448 enableTypeAssertions: enableTypeAssertions, |
441 enableUserAssertions: enableUserAssertions, | 449 enableUserAssertions: enableUserAssertions, |
442 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, | 450 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, |
443 generateSourceMap: generateSourceMap, | 451 generateSourceMap: generateSourceMap, |
444 hasIncrementalSupport: hasIncrementalSupport, | 452 hasIncrementalSupport: hasIncrementalSupport, |
445 outputUri: outputUri, | 453 outputUri: outputUri, |
446 platformConfigUri: platformConfigUri ?? | 454 platformConfigUri: platformConfigUri ?? |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 this.terseDiagnostics: false, | 488 this.terseDiagnostics: false, |
481 this.suppressWarnings: false, | 489 this.suppressWarnings: false, |
482 this.suppressHints: false, | 490 this.suppressHints: false, |
483 List<String> shownPackageWarnings: null, | 491 List<String> shownPackageWarnings: null, |
484 this.disableInlining: false, | 492 this.disableInlining: false, |
485 this.disableTypeInference: false, | 493 this.disableTypeInference: false, |
486 this.dumpInfo: false, | 494 this.dumpInfo: false, |
487 this.emitJavaScript: true, | 495 this.emitJavaScript: true, |
488 this.enableAssertMessage: false, | 496 this.enableAssertMessage: false, |
489 this.enableGenericMethodSyntax: false, | 497 this.enableGenericMethodSyntax: false, |
| 498 this.enableInitializingFormalAccess: false, |
490 this.enableExperimentalMirrors: false, | 499 this.enableExperimentalMirrors: false, |
491 this.enableMinification: false, | 500 this.enableMinification: false, |
492 this.enableNativeLiveTypeAnalysis: false, | 501 this.enableNativeLiveTypeAnalysis: false, |
493 this.enableTypeAssertions: false, | 502 this.enableTypeAssertions: false, |
494 this.enableUserAssertions: false, | 503 this.enableUserAssertions: false, |
495 this.generateCodeWithCompileTimeErrors: false, | 504 this.generateCodeWithCompileTimeErrors: false, |
496 this.generateSourceMap: true, | 505 this.generateSourceMap: true, |
497 this.hasIncrementalSupport: false, | 506 this.hasIncrementalSupport: false, |
498 this.outputUri: null, | 507 this.outputUri: null, |
499 this.platformConfigUri: null, | 508 this.platformConfigUri: null, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 623 |
615 /// Locations of the platform descriptor files relative to the library root. | 624 /// Locations of the platform descriptor files relative to the library root. |
616 const String _clientPlatform = "lib/dart_client.platform"; | 625 const String _clientPlatform = "lib/dart_client.platform"; |
617 const String _serverPlatform = "lib/dart_server.platform"; | 626 const String _serverPlatform = "lib/dart_server.platform"; |
618 const String _sharedPlatform = "lib/dart_shared.platform"; | 627 const String _sharedPlatform = "lib/dart_shared.platform"; |
619 const String _dart2dartPlatform = "lib/dart2dart.platform"; | 628 const String _dart2dartPlatform = "lib/dart2dart.platform"; |
620 | 629 |
621 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; | 630 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; |
622 const bool _forceIncrementalSupport = | 631 const bool _forceIncrementalSupport = |
623 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); | 632 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
OLD | NEW |