| 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 import 'dart:collection' show HashSet; | 5 import 'dart:collection' show HashSet; |
| 6 import 'package:args/args.dart' show ArgParser, ArgResults; | 6 import 'package:args/args.dart' show ArgParser, ArgResults; |
| 7 import 'package:analyzer/analyzer.dart' | 7 import 'package:analyzer/analyzer.dart' |
| 8 show | 8 show |
| 9 AnalysisError, | 9 AnalysisError, |
| 10 CompilationUnit, | 10 CompilationUnit, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 /// Which module format to support. | 178 /// Which module format to support. |
| 179 /// Currently 'es6' and 'legacy' are supported. | 179 /// Currently 'es6' and 'legacy' are supported. |
| 180 final ModuleFormat moduleFormat; | 180 final ModuleFormat moduleFormat; |
| 181 | 181 |
| 182 const CompilerOptions( | 182 const CompilerOptions( |
| 183 {this.sourceMap: true, | 183 {this.sourceMap: true, |
| 184 this.sourceMapComment: true, | 184 this.sourceMapComment: true, |
| 185 this.summarizeApi: true, | 185 this.summarizeApi: true, |
| 186 this.unsafeForceCompile: false, | 186 this.unsafeForceCompile: false, |
| 187 this.emitMetadata: true, | 187 this.emitMetadata: false, |
| 188 this.closure: false, | 188 this.closure: false, |
| 189 this.destructureNamedParams: false, | 189 this.destructureNamedParams: false, |
| 190 this.moduleFormat: ModuleFormat.legacy}); | 190 this.moduleFormat: ModuleFormat.legacy}); |
| 191 | 191 |
| 192 CompilerOptions.fromArguments(ArgResults args) | 192 CompilerOptions.fromArguments(ArgResults args) |
| 193 : sourceMap = args['source-map'], | 193 : sourceMap = args['source-map'], |
| 194 sourceMapComment = args['source-map-comment'], | 194 sourceMapComment = args['source-map-comment'], |
| 195 summarizeApi = args['summarize'], | 195 summarizeApi = args['summarize'], |
| 196 unsafeForceCompile = args['unsafe-force-compile'], | 196 unsafeForceCompile = args['unsafe-force-compile'], |
| 197 emitMetadata = args['emit-metadata'], | 197 emitMetadata = args['emit-metadata'], |
| (...skipping 12 matching lines...) Expand all Loading... |
| 210 help: 'module pattern to emit', | 210 help: 'module pattern to emit', |
| 211 allowed: ['es6', 'legacy', 'node'], | 211 allowed: ['es6', 'legacy', 'node'], |
| 212 allowedHelp: { | 212 allowedHelp: { |
| 213 'es6': 'es6 modules', | 213 'es6': 'es6 modules', |
| 214 'legacy': 'a custom format used by dartdevc, similar to AMD', | 214 'legacy': 'a custom format used by dartdevc, similar to AMD', |
| 215 'node': 'node.js modules (https://nodejs.org/api/modules.html)' | 215 'node': 'node.js modules (https://nodejs.org/api/modules.html)' |
| 216 }, | 216 }, |
| 217 defaultsTo: 'legacy') | 217 defaultsTo: 'legacy') |
| 218 ..addFlag('emit-metadata', | 218 ..addFlag('emit-metadata', |
| 219 help: 'emit metadata annotations queriable via mirrors', | 219 help: 'emit metadata annotations queriable via mirrors', |
| 220 defaultsTo: true) | 220 defaultsTo: false) |
| 221 ..addFlag('closure-experimental', | 221 ..addFlag('closure-experimental', |
| 222 help: 'emit Closure Compiler-friendly code (experimental)', | 222 help: 'emit Closure Compiler-friendly code (experimental)', |
| 223 defaultsTo: false) | 223 defaultsTo: false) |
| 224 ..addFlag('destructure-named-params', | 224 ..addFlag('destructure-named-params', |
| 225 help: 'Destructure named parameters', defaultsTo: false) | 225 help: 'Destructure named parameters', defaultsTo: false) |
| 226 ..addFlag('unsafe-force-compile', | 226 ..addFlag('unsafe-force-compile', |
| 227 help: 'Compile code even if it has errors. ಠ_ಠ\n' | 227 help: 'Compile code even if it has errors. ಠ_ಠ\n' |
| 228 'This has undefined behavior!', | 228 'This has undefined behavior!', |
| 229 defaultsTo: false); | 229 defaultsTo: false); |
| 230 } | 230 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 /// (Public for tests) the error code used when a part is missing. | 311 /// (Public for tests) the error code used when a part is missing. |
| 312 final missingPartErrorCode = const CompileTimeErrorCode( | 312 final missingPartErrorCode = const CompileTimeErrorCode( |
| 313 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); | 313 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); |
| 314 | 314 |
| 315 /// (Public for tests) the error code used when a part is unused. | 315 /// (Public for tests) the error code used when a part is unused. |
| 316 final unusedPartWarningCode = const StaticWarningCode( | 316 final unusedPartWarningCode = const StaticWarningCode( |
| 317 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); | 317 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); |
| OLD | NEW |