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

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

Issue 2932513003: Add getTarget method to CompilerCommandLine (Closed)
Patch Set: Adjust CL to the changes in "master" Created 3 years, 6 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/compile_platform.dart ('k') | pkg/front_end/lib/src/fasta/fasta.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 1c415a1229dba2d5ac6d45065fdf05d965a0bb7b..99e822ad41cbfabc59f6842d961fecbc7820c3a8 100644
--- a/pkg/front_end/lib/src/fasta/compiler_command_line.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_command_line.dart
@@ -10,6 +10,9 @@ import 'command_line.dart' show CommandLine, argumentError;
import 'compiler_context.dart' show CompilerContext;
+import 'package:kernel/target/targets.dart'
+ show Target, getTarget, TargetFlags, targets;
+
const Map<String, dynamic> optionSpecification = const <String, dynamic>{
"--compile-sdk": Uri,
"--fatal": ",",
@@ -60,6 +63,16 @@ class CompilerCommandLine extends CommandLine {
} else if (arguments.isEmpty) {
return argumentError(usage, "No Dart file specified.");
}
+
+ Target target =
+ getTarget(targetName, new TargetFlags(strongMode: strongMode));
+ if (target == null) {
+ return argumentError(
+ usage,
+ "Target '${targetName}' not recognized. "
+ "Valid targets are:\n ${targets.keys.join("\n ")}");
+ }
+ options["target"] = target;
}
Uri get output {
@@ -90,10 +103,12 @@ class CompilerCommandLine extends CommandLine {
bool get strongMode => options.containsKey("--strong-mode");
- String get target {
+ String get targetName {
return options["-t"] ?? options["--target"] ?? "vm_fasta";
}
+ Target get target => options["target"];
+
static dynamic withGlobalOptions(String programName, List<String> arguments,
dynamic f(CompilerContext context)) {
return CompilerContext.withGlobalOptions(
« no previous file with comments | « pkg/front_end/lib/src/fasta/compile_platform.dart ('k') | pkg/front_end/lib/src/fasta/fasta.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698