Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler; | 5 package com.google.dart.compiler; |
| 6 | 6 |
| 7 import com.google.common.collect.Lists; | 7 import com.google.common.collect.Lists; |
| 8 import com.google.dart.compiler.CompilerConfiguration.ErrorFormat; | |
| 8 import com.google.dart.runner.DartRunner; | 9 import com.google.dart.runner.DartRunner; |
| 9 import com.google.dart.runner.RunnerOptions; | 10 import com.google.dart.runner.RunnerOptions; |
| 10 | 11 |
| 11 import org.kohsuke.args4j.Argument; | 12 import org.kohsuke.args4j.Argument; |
| 12 import org.kohsuke.args4j.CmdLineException; | 13 import org.kohsuke.args4j.CmdLineException; |
| 13 import org.kohsuke.args4j.CmdLineParser; | 14 import org.kohsuke.args4j.CmdLineParser; |
| 14 import org.kohsuke.args4j.Option; | 15 import org.kohsuke.args4j.Option; |
| 15 | 16 |
| 16 import java.io.File; | 17 import java.io.File; |
| 17 import java.util.ArrayList; | 18 import java.util.ArrayList; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 34 usage = "Batch mode (for unit testing)") | 35 usage = "Batch mode (for unit testing)") |
| 35 private boolean batch = false; | 36 private boolean batch = false; |
| 36 | 37 |
| 37 @Option(name = "--check-only", aliases = { "-check-only" }, | 38 @Option(name = "--check-only", aliases = { "-check-only" }, |
| 38 usage = "Do not generate output, only analyze") | 39 usage = "Do not generate output, only analyze") |
| 39 private boolean checkOnly = false; | 40 private boolean checkOnly = false; |
| 40 | 41 |
| 41 @Option(name = "--expose_core_impl", usage = "Automatic import of dart:corei mpl library") | 42 @Option(name = "--expose_core_impl", usage = "Automatic import of dart:corei mpl library") |
| 42 private boolean exposeCoreImpl = false; | 43 private boolean exposeCoreImpl = false; |
| 43 | 44 |
| 44 @Option(name = "--machine-problems", | 45 @Option(name = "--error_format", |
| 45 usage = "Format errors for machine parsing") | 46 usage = "Format errors as normal, machine, or GNU") |
|
zundel
2011/12/22 15:32:31
remove gnu
codefu
2011/12/22 15:38:20
Done.
| |
| 46 private boolean printMachineProblems = false; | 47 private String errorFormat = ""; |
| 47 | 48 |
| 48 @Option(name = "--enable_type_checks", | 49 @Option(name = "--enable_type_checks", |
| 49 usage = "Generate runtime type checks") | 50 usage = "Generate runtime type checks") |
| 50 private boolean developerModeChecks = false; | 51 private boolean developerModeChecks = false; |
| 51 | 52 |
| 52 @Option(name = "--disable-type-optimizations", | 53 @Option(name = "--disable-type-optimizations", |
| 53 usage = "Turn off type optimizations\n (for debugging)") | 54 usage = "Turn off type optimizations\n (for debugging)") |
| 54 private boolean disableTypeOptimizations = false; | 55 private boolean disableTypeOptimizations = false; |
| 55 | 56 |
| 56 @Option(name = "--documentation-lib", aliases = { "-documentation-lib" }, | 57 @Option(name = "--documentation-lib", aliases = { "-documentation-lib" }, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 | 288 |
| 288 public boolean showJvmMetrics() { | 289 public boolean showJvmMetrics() { |
| 289 return showJvmMetrics; | 290 return showJvmMetrics; |
| 290 } | 291 } |
| 291 | 292 |
| 292 public boolean showMetrics() { | 293 public boolean showMetrics() { |
| 293 return showMetrics; | 294 return showMetrics; |
| 294 } | 295 } |
| 295 | 296 |
| 296 /** | 297 /** |
| 297 * Returns <code>true</code> if the compiler should print compilation proble ms in machine | |
| 298 * format, with all information - severity, subsystem, etc. | |
| 299 */ | |
| 300 public boolean printMachineProblems() { | |
| 301 return printMachineProblems; | |
| 302 } | |
| 303 | |
| 304 /** | |
| 305 * Returns whether type errors are fatal. | 298 * Returns whether type errors are fatal. |
| 306 */ | 299 */ |
| 307 public boolean typeErrorsAreFatal() { | 300 public boolean typeErrorsAreFatal() { |
| 308 return typeErrorsAreFatal; | 301 return typeErrorsAreFatal; |
| 309 } | 302 } |
| 310 | 303 |
| 311 /** | 304 /** |
| 312 * Returns whether warnings (excluding type warnings) are fatal. | 305 * Returns whether warnings (excluding type warnings) are fatal. |
| 313 */ | 306 */ |
| 314 public boolean warningsAreFatal() { | 307 public boolean warningsAreFatal() { |
| 315 return warningsAreFatal; | 308 return warningsAreFatal; |
| 316 } | 309 } |
| 317 | 310 |
| 318 public boolean developerModeChecks() { | 311 public boolean developerModeChecks() { |
| 319 return developerModeChecks; | 312 return developerModeChecks; |
| 320 } | 313 } |
| 314 | |
| 315 /** | |
| 316 * @return the format to use for printing errors | |
| 317 */ | |
| 318 public ErrorFormat printErrorFormat() { | |
| 319 String lowerError = errorFormat.toLowerCase(); | |
| 320 if ("machine".equals(lowerError)) { | |
| 321 return ErrorFormat.MACHINE; | |
| 322 } | |
| 323 return ErrorFormat.NORMAL; | |
| 324 } | |
| 321 } | 325 } |
| 322 | 326 |
| 323 /** | 327 /** |
| 324 * Command line options accepted by the {@link DartRunner} entry point. | 328 * Command line options accepted by the {@link DartRunner} entry point. |
| 325 */ | 329 */ |
| 326 public static class DartRunnerOptions extends CompilerOptions implements Runne rOptions { | 330 public static class DartRunnerOptions extends CompilerOptions implements Runne rOptions { |
| 327 | 331 |
| 328 @Option(name = "--compile-only", usage = "Compile but do not execute") | 332 @Option(name = "--compile-only", usage = "Compile but do not execute") |
| 329 private boolean compileOnly = false; | 333 private boolean compileOnly = false; |
| 330 | 334 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 args = newArgs.toArray(new String[newArgs.size()]); | 426 args = newArgs.toArray(new String[newArgs.size()]); |
| 423 cmdLineParser = new CmdLineParser(parsedOptions); | 427 cmdLineParser = new CmdLineParser(parsedOptions); |
| 424 continue; | 428 continue; |
| 425 } | 429 } |
| 426 } | 430 } |
| 427 break; | 431 break; |
| 428 } | 432 } |
| 429 return cmdLineParser; | 433 return cmdLineParser; |
| 430 } | 434 } |
| 431 } | 435 } |
| OLD | NEW |