| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 /// Directory where to dump the orignal but formatted Dart sources. This is | 91 /// Directory where to dump the orignal but formatted Dart sources. This is |
| 92 /// mainly used to make it easier to compare input and output files. | 92 /// mainly used to make it easier to compare input and output files. |
| 93 final String dumpSrcDir; | 93 final String dumpSrcDir; |
| 94 | 94 |
| 95 /// Whether to force compilation of code with static errors. | 95 /// Whether to force compilation of code with static errors. |
| 96 final bool forceCompile; | 96 final bool forceCompile; |
| 97 | 97 |
| 98 /// Whether to run the dart_style formatter on the generated Dart code. | 98 /// Whether to run the dart_style formatter on the generated Dart code. |
| 99 final bool formatOutput; | 99 final bool formatOutput; |
| 100 | 100 |
| 101 /// Whether to use a cheap formatter instead of dart_style. This might not be |
| 102 /// a semantically correct formatter and it is used for testing only. |
| 103 final bool cheapTestFormat; |
| 104 |
| 101 /// Output directory for generated code. | 105 /// Output directory for generated code. |
| 102 final String outputDir; | 106 final String outputDir; |
| 103 | 107 |
| 104 /// Whether to emit Dart output (false means to emit JS output). | 108 /// Whether to emit Dart output (false means to emit JS output). |
| 105 final bool outputDart; | 109 final bool outputDart; |
| 106 | 110 |
| 107 /// Whether to use colors when interacting on the console. | 111 /// Whether to use colors when interacting on the console. |
| 108 final bool useColors; | 112 final bool useColors; |
| 109 | 113 |
| 110 /// Whether the user asked for help. | 114 /// Whether the user asked for help. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 /// List of non-nullable types. | 168 /// List of non-nullable types. |
| 165 @override | 169 @override |
| 166 final List<String> nonnullableTypes; | 170 final List<String> nonnullableTypes; |
| 167 | 171 |
| 168 /// Whether to use static types for code generation. | 172 /// Whether to use static types for code generation. |
| 169 @override | 173 @override |
| 170 final bool ignoreTypes; | 174 final bool ignoreTypes; |
| 171 | 175 |
| 172 CompilerOptions({this.checkSdk: false, this.dumpInfo: false, | 176 CompilerOptions({this.checkSdk: false, this.dumpInfo: false, |
| 173 this.dumpInfoFile, this.dumpSrcDir, this.forceCompile: false, | 177 this.dumpInfoFile, this.dumpSrcDir, this.forceCompile: false, |
| 174 this.formatOutput: false, this.ignoreTypes: false, this.outputDir, | 178 this.formatOutput: false, this.cheapTestFormat: false, |
| 175 this.outputDart: false, this.useColors: true, | 179 this.ignoreTypes: false, this.outputDir, this.outputDart: false, |
| 176 this.covariantGenerics: true, this.relaxedCasts: true, | 180 this.useColors: true, this.covariantGenerics: true, |
| 177 this.useMultiPackage: false, this.packageRoot: 'packages/', | 181 this.relaxedCasts: true, this.useMultiPackage: false, |
| 178 this.packagePaths: const [], this.inferFromOverrides: true, | 182 this.packageRoot: 'packages/', this.packagePaths: const [], |
| 179 this.inferStaticsFromIdentifiers: false, | 183 this.inferFromOverrides: true, this.inferStaticsFromIdentifiers: false, |
| 180 this.inferInNonStableOrder: false, | 184 this.inferInNonStableOrder: false, |
| 181 this.onlyInferConstsAndFinalFields: false, | 185 this.onlyInferConstsAndFinalFields: false, |
| 182 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, | 186 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, |
| 183 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, | 187 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, |
| 184 this.entryPointFile: null}); | 188 this.entryPointFile: null}); |
| 185 } | 189 } |
| 186 | 190 |
| 187 /// Parses options from the command-line | 191 /// Parses options from the command-line |
| 188 CompilerOptions parseOptions(List<String> argv) { | 192 CompilerOptions parseOptions(List<String> argv) { |
| 189 ArgResults args = argParser.parse(argv); | 193 ArgResults args = argParser.parse(argv); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ..addFlag('help', abbr: 'h', help: 'Display this message') | 278 ..addFlag('help', abbr: 'h', help: 'Display this message') |
| 275 ..addFlag('force-compile', | 279 ..addFlag('force-compile', |
| 276 help: 'Compile code with static errors', defaultsTo: false) | 280 help: 'Compile code with static errors', defaultsTo: false) |
| 277 ..addOption('log', abbr: 'l', help: 'Logging level', defaultsTo: 'severe') | 281 ..addOption('log', abbr: 'l', help: 'Logging level', defaultsTo: 'severe') |
| 278 ..addFlag('dump-info', | 282 ..addFlag('dump-info', |
| 279 abbr: 'i', help: 'Dump summary information', defaultsTo: false) | 283 abbr: 'i', help: 'Dump summary information', defaultsTo: false) |
| 280 ..addOption('dump-info-file', | 284 ..addOption('dump-info-file', |
| 281 abbr: 'f', | 285 abbr: 'f', |
| 282 help: 'Dump info json file (requires dump-info)', | 286 help: 'Dump info json file (requires dump-info)', |
| 283 defaultsTo: null); | 287 defaultsTo: null); |
| OLD | NEW |