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