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

Unified Diff: pkg/front_end/lib/src/fasta/compiler_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
« no previous file with comments | « pkg/front_end/lib/src/fasta/command_line.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fca56efe5640f71627c07db506addc93d19eccbd..885f01f218f778045b6480d955a3b62efb2f4f5c 100644
--- a/pkg/front_end/lib/src/fasta/compiler_command_line.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_command_line.dart
@@ -13,6 +13,13 @@ import 'compiler_context.dart' show CompilerContext;
import 'package:kernel/target/targets.dart'
show Target, getTarget, TargetFlags, targets;
+import 'fasta_codes.dart'
+ show
+ Message,
+ messageFastaUsageLong,
+ messageFastaUsageShort,
+ templateUnspecified;
+
const Map<String, dynamic> optionSpecification = const <String, dynamic>{
"--compile-sdk": Uri,
"--fatal": ",",
@@ -128,10 +135,12 @@ class CompilerCommandLine extends CommandLine {
}
}
-String computeUsage(String programName, bool verbose) {
+Message computeUsage(String programName, bool verbose) {
String basicUsage = "Usage: $programName [options] dartfile\n";
String summary;
- String options = (verbose ? allOptions : frequentOptions).trim();
+ String options =
+ (verbose ? messageFastaUsageLong.message : messageFastaUsageShort.message)
+ .trim();
switch (programName) {
case "outline":
summary =
@@ -163,65 +172,6 @@ String computeUsage(String programName, bool verbose) {
sb.writeln();
}
sb.write(options);
- return "$sb";
+ // TODO(ahe): Don't use [templateUnspecified].
+ return templateUnspecified.withArguments("$sb");
}
-
-const String frequentOptions = """
-Frequently used options:
-
- -o <file> Generate the output into <file>.
- -h Display this message (add -v for information about all options).
-""";
-
-const String allOptions = """
-Supported options:
-
- -o <file>, --output=<file>
- Generate the output into <file>.
-
- -h, /h, /?, --help
- Display this message (add -v for information about all options).
-
- -v, --verbose
- Display verbose information.
-
- --
- Stop option parsing, the rest of the command line is assumed to be
- file names or arguments to the Dart program.
-
- --packages=<file>
- Use package resolution configuration <file>, which should contain a mapping
- of package names to paths.
-
- --platform=<file>
- Read the SDK platform from <file>, which should be in Dill/Kernel IR format
- and contain the Dart SDK.
-
- --target=none|vm|vmcc|vmreify|flutter
- Specify the target configuration.
-
- --verify
- Check that the generated output is free of various problems. This is mostly
- useful for developers of this compiler or Kernel transformations.
-
- --dump-ir
- Print compiled libraries in Kernel source notation.
-
- --exclude-source
- Do not include source code in the dill file.
-
- --compile-sdk=<patched_sdk>
- Compile the SDK from scratch instead of reading it from 'platform.dill'.
-
- --sdk=<patched_sdk>
- Location of the SDK sources for use when compiling additional platform
- libraries.
-
- --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.
-""";
« no previous file with comments | « pkg/front_end/lib/src/fasta/command_line.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698