Index: pkg/front_end/lib/src/fasta/compiler_command_line.dart |
diff --git a/pkg/front_end/lib/src/fasta/compiler_command_line.dart b/pkg/front_end/lib/src/fasta/compiler_command_line.dart |
index 2413488ea7a3f6f6db6f4cff02130b882f52c465..6cd3478b5a55551070d955dd4e0107010d879887 100644 |
--- a/pkg/front_end/lib/src/fasta/compiler_command_line.dart |
+++ b/pkg/front_end/lib/src/fasta/compiler_command_line.dart |
@@ -11,11 +11,15 @@ import 'command_line.dart' show |
CommandLine, |
argumentError; |
+import 'compiler_context.dart' show |
+ CompilerContext; |
+ |
const Map<String, dynamic> optionSpecification = const <String, dynamic>{ |
"-o": Uri, |
"--output": Uri, |
"--platform": Uri, |
"--packages": Uri, |
+ "--fatal": ",", |
}; |
class CompilerCommandLine extends CommandLine { |
@@ -65,6 +69,26 @@ class CompilerCommandLine extends CommandLine { |
? null |
: options["--platform"] ?? Uri.base.resolve("platform.dill"); |
} |
+ |
+ Set<String> get fatal { |
+ return new Set<String>.from(options["--fatal"] ?? <String>[]); |
+ } |
+ |
+ bool get areErrorsFatal => fatal.contains("errors"); |
+ |
+ bool get areWarningsFatal => fatal.contains("warnings"); |
+ |
+ bool get areNitsFatal => fatal.contains("nits"); |
+ |
+ static dynamic withGlobalOptions(String programName, List<String> arguments, |
+ dynamic f(CompilerContext context)) { |
+ return CompilerContext.withGlobalOptions( |
+ new CompilerCommandLine(programName, arguments), f); |
+ } |
+ |
+ static CompilerCommandLine forRootContext() { |
+ return new CompilerCommandLine("", [""]); |
+ } |
} |
String computeUsage(String programName, bool verbose) { |
@@ -140,4 +164,12 @@ Supported options: |
--compile-sdk |
Compile the SDK from scratch instead of reading it from 'platform.dill'. |
+ |
+ --fatal=errors |
+ --fatal=warnings |
+ --fatal=nits |
+ Makes messages of the given kinds fatal, that is, immediately stop the |
+ compiler with a non-zero exit-code. In --verbose mode, also display an |
+ internal stack trace from the compiler. Multiple kinds can be separated by |
+ commas, for example, --fatal=errors,warnings. |
"""; |