Chromium Code Reviews| 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..ad52a059306fc85d3a9e32528b49378ca49dcc4b 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. " |
|
ahe
2017/06/09 08:29:18
Add single quote after }.
Dmitry Stefantsov
2017/06/09 08:37:04
Good catch! Thanks! Fixed.
|
| + "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( |