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

Side by Side Diff: pkg/front_end/lib/src/fasta/compiler_command_line.dart

Issue 2878383003: Fix command line args validation for platform compilation with fasta (Closed)
Patch Set: Remove the comment, fix the error message Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.compiler_command_line; 5 library fasta.compiler_command_line;
6 6
7 import 'dart:io' show exit; 7 import 'dart:io' show exit;
8 8
9 import 'command_line.dart' show CommandLine, argumentError; 9 import 'command_line.dart' show CommandLine, argumentError;
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void validate() { 44 void validate() {
45 if (help) { 45 if (help) {
46 print(computeUsage(programName, verbose)); 46 print(computeUsage(programName, verbose));
47 exit(0); 47 exit(0);
48 } 48 }
49 49
50 if (options.containsKey("-o") && options.containsKey("--output")) { 50 if (options.containsKey("-o") && options.containsKey("--output")) {
51 return argumentError(usage, "Can't specify both '-o' and '--output'."); 51 return argumentError(usage, "Can't specify both '-o' and '--output'.");
52 } 52 }
53 if (programName == "compile_platform" && arguments.length != 2) { 53 if (programName == "compile_platform" && arguments.length != 3) {
54 return argumentError(usage, "Expected two arguments."); 54 return argumentError(usage, "Expected three arguments.");
55 } else if (arguments.isEmpty) { 55 } else if (arguments.isEmpty) {
56 return argumentError(usage, "No Dart file specified."); 56 return argumentError(usage, "No Dart file specified.");
57 } 57 }
58 } 58 }
59 59
60 Uri get output { 60 Uri get output {
61 return options["-o"] ?? options["--output"] ?? defaultOutput; 61 return options["-o"] ?? options["--output"] ?? defaultOutput;
62 } 62 }
63 63
64 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); 64 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 summary = 114 summary =
115 "Compiles a Dart program to the Dill/Kernel IR format via dartk."; 115 "Compiles a Dart program to the Dill/Kernel IR format via dartk.";
116 break; 116 break;
117 117
118 case "run": 118 case "run":
119 summary = "Runs a Dart program."; 119 summary = "Runs a Dart program.";
120 break; 120 break;
121 121
122 case "compile_platform": 122 case "compile_platform":
123 summary = "Compiles Dart SDK platform to the Dill/Kernel IR format."; 123 summary = "Compiles Dart SDK platform to the Dill/Kernel IR format.";
124 basicUsage = "Usage: $programName [options] patched_sdk output\n"; 124 basicUsage = "Usage: $programName [options] patched_sdk fullOutput "
125 "outlineOutput\n";
125 } 126 }
126 StringBuffer sb = new StringBuffer(basicUsage); 127 StringBuffer sb = new StringBuffer(basicUsage);
127 if (summary != null) { 128 if (summary != null) {
128 sb.writeln(); 129 sb.writeln();
129 sb.writeln(summary); 130 sb.writeln(summary);
130 sb.writeln(); 131 sb.writeln();
131 } 132 }
132 sb.write(options); 133 sb.write(options);
133 return "$sb"; 134 return "$sb";
134 } 135 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 Compile the SDK from scratch instead of reading it from 'platform.dill'. 179 Compile the SDK from scratch instead of reading it from 'platform.dill'.
179 180
180 --fatal=errors 181 --fatal=errors
181 --fatal=warnings 182 --fatal=warnings
182 --fatal=nits 183 --fatal=nits
183 Makes messages of the given kinds fatal, that is, immediately stop the 184 Makes messages of the given kinds fatal, that is, immediately stop the
184 compiler with a non-zero exit-code. In --verbose mode, also display an 185 compiler with a non-zero exit-code. In --verbose mode, also display an
185 internal stack trace from the compiler. Multiple kinds can be separated by 186 internal stack trace from the compiler. Multiple kinds can be separated by
186 commas, for example, --fatal=errors,warnings. 187 commas, for example, --fatal=errors,warnings.
187 """; 188 """;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698