| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Set of flags and options passed to the compiler | 5 /// Set of flags and options passed to the compiler |
| 6 library ddc.src.options; | 6 library ddc.src.options; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 /// Note: this option is experimental will be removed once we have a proper | 47 /// Note: this option is experimental will be removed once we have a proper |
| 48 /// implementation of inference in the future, which should handle all | 48 /// implementation of inference in the future, which should handle all |
| 49 /// ordering concerns. | 49 /// ordering concerns. |
| 50 final bool inferInNonStableOrder; | 50 final bool inferInNonStableOrder; |
| 51 | 51 |
| 52 /// Restrict inference of fields and top-levels to those that are final and | 52 /// Restrict inference of fields and top-levels to those that are final and |
| 53 /// const. | 53 /// const. |
| 54 final bool onlyInferConstsAndFinalFields; | 54 final bool onlyInferConstsAndFinalFields; |
| 55 | 55 |
| 56 ResolverOptions({this.useMultiPackage: false, this.packageRoot: 'packages/', | 56 ResolverOptions({this.useMultiPackage: false, this.packageRoot: 'packages/', |
| 57 this.packagePaths: const [], this.inferFromOverrides: true, | 57 this.packagePaths: const <String>[], this.inferFromOverrides: true, |
| 58 this.inferStaticsFromIdentifiers: false, | 58 this.inferStaticsFromIdentifiers: false, |
| 59 this.inferInNonStableOrder: false, | 59 this.inferInNonStableOrder: false, |
| 60 this.onlyInferConstsAndFinalFields: false}); | 60 this.onlyInferConstsAndFinalFields: false}); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // TODO(vsm): Merge RulesOptions and TypeOptions | 63 // TODO(vsm): Merge RulesOptions and TypeOptions |
| 64 /// Options used by ddc's RestrictedRules. | 64 /// Options used by ddc's RestrictedRules. |
| 65 class RulesOptions extends TypeOptions { | 65 class RulesOptions extends TypeOptions { |
| 66 /// Whether to allow casts in constant contexts. | 66 /// Whether to allow casts in constant contexts. |
| 67 final bool allowConstCasts; | 67 final bool allowConstCasts; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 @override | 180 @override |
| 181 final bool ignoreTypes; | 181 final bool ignoreTypes; |
| 182 | 182 |
| 183 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false, | 183 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false, |
| 184 this.dumpInfo: false, this.dumpInfoFile, this.dumpSrcDir, | 184 this.dumpInfo: false, this.dumpInfoFile, this.dumpSrcDir, |
| 185 this.forceCompile: false, this.formatOutput: false, | 185 this.forceCompile: false, this.formatOutput: false, |
| 186 this.cheapTestFormat: false, this.ignoreTypes: false, this.outputDir, | 186 this.cheapTestFormat: false, this.ignoreTypes: false, this.outputDir, |
| 187 this.outputDart: false, this.useColors: true, | 187 this.outputDart: false, this.useColors: true, |
| 188 this.covariantGenerics: true, this.relaxedCasts: true, | 188 this.covariantGenerics: true, this.relaxedCasts: true, |
| 189 this.useMultiPackage: false, this.packageRoot: 'packages/', | 189 this.useMultiPackage: false, this.packageRoot: 'packages/', |
| 190 this.packagePaths: const [], this.inferFromOverrides: true, | 190 this.packagePaths: const <String>[], this.inferFromOverrides: true, |
| 191 this.inferStaticsFromIdentifiers: false, | 191 this.inferStaticsFromIdentifiers: false, |
| 192 this.inferInNonStableOrder: false, | 192 this.inferInNonStableOrder: false, |
| 193 this.onlyInferConstsAndFinalFields: false, | 193 this.onlyInferConstsAndFinalFields: false, |
| 194 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, | 194 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, |
| 195 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, | 195 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, |
| 196 this.entryPointFile: null}); | 196 this.entryPointFile: null}); |
| 197 } | 197 } |
| 198 | 198 |
| 199 /// Parses options from the command-line | 199 /// Parses options from the command-line |
| 200 CompilerOptions parseOptions(List<String> argv) { | 200 CompilerOptions parseOptions(List<String> argv) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 ..addFlag('help', abbr: 'h', help: 'Display this message') | 289 ..addFlag('help', abbr: 'h', help: 'Display this message') |
| 290 ..addFlag('force-compile', | 290 ..addFlag('force-compile', |
| 291 help: 'Compile code with static errors', defaultsTo: false) | 291 help: 'Compile code with static errors', defaultsTo: false) |
| 292 ..addOption('log', abbr: 'l', help: 'Logging level', defaultsTo: 'severe') | 292 ..addOption('log', abbr: 'l', help: 'Logging level', defaultsTo: 'severe') |
| 293 ..addFlag('dump-info', | 293 ..addFlag('dump-info', |
| 294 abbr: 'i', help: 'Dump summary information', defaultsTo: false) | 294 abbr: 'i', help: 'Dump summary information', defaultsTo: false) |
| 295 ..addOption('dump-info-file', | 295 ..addOption('dump-info-file', |
| 296 abbr: 'f', | 296 abbr: 'f', |
| 297 help: 'Dump info json file (requires dump-info)', | 297 help: 'Dump info json file (requires dump-info)', |
| 298 defaultsTo: null); | 298 defaultsTo: null); |
| OLD | NEW |