Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Unified Diff: pkg/front_end/lib/src/fasta/command_line.dart

Issue 2965393002: Use FastaMessage instead of String. Part 1. (Closed)
Patch Set: Add type variable to Code. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/command_line.dart
diff --git a/pkg/front_end/lib/src/fasta/command_line.dart b/pkg/front_end/lib/src/fasta/command_line.dart
index 8916a45693b07e44fe1bddb40d7015475c324fdb..9f95255ec4ca82ef6c762a4190f06e4ca88af707 100644
--- a/pkg/front_end/lib/src/fasta/command_line.dart
+++ b/pkg/front_end/lib/src/fasta/command_line.dart
@@ -4,14 +4,21 @@
library fasta.command_line;
+import 'fasta_codes.dart' show Message, templateFastaCLIArgumentRequired;
+
import 'deprecated_problems.dart'
show deprecated_inputError, deprecated_internalProblem;
-deprecated_argumentError(String usage, String message) {
- if (usage != null) print(usage);
+deprecated_argumentError(Message usage, String message) {
+ if (usage != null) print(usage.message);
deprecated_inputError(null, null, message);
}
+argumentError(Message usage, Message message) {
+ if (usage != null) print(usage.message);
+ deprecated_inputError(null, null, message.message);
+}
+
class ParsedArguments {
final Map<String, dynamic> options = <String, dynamic>{};
final List<String> arguments = <String>[];
@@ -24,7 +31,7 @@ class CommandLine {
final List<String> arguments;
- final String usage;
+ final Message usage;
CommandLine.parsed(ParsedArguments p, this.usage)
: this.options = p.options,
@@ -36,7 +43,7 @@ class CommandLine {
}
CommandLine(List<String> arguments,
- {Map<String, dynamic> specification, String usage})
+ {Map<String, dynamic> specification, Message usage})
: this.parsed(parse(arguments, specification, usage), usage);
bool get verbose {
@@ -72,7 +79,7 @@ class CommandLine {
/// This method performs only a limited amount of validation, but if an error
/// occurs, it will print [usage] along with a specific error message.
static ParsedArguments parse(List<String> arguments,
- Map<String, dynamic> specification, String usage) {
+ Map<String, dynamic> specification, Message usage) {
specification ??= const <String, dynamic>{};
ParsedArguments result = new ParsedArguments();
int index = arguments.indexOf("--");
@@ -89,8 +96,8 @@ class CommandLine {
String value;
if (valueSpecification != null) {
if (!iterator.moveNext()) {
- return deprecated_argumentError(
- usage, "Expected value after '$argument'.");
+ return argumentError(usage,
+ templateFastaCLIArgumentRequired.withArguments(argument));
}
value = iterator.current;
} else {
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/library_builder.dart ('k') | pkg/front_end/lib/src/fasta/compiler_command_line.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698