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

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

Issue 2704753002: Implement line and column numbers. (Closed)
Patch Set: Change message. Created 3 years, 10 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
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 7 import 'dart:io' show
8 exit; 8 exit;
9 9
10 import 'command_line.dart' show 10 import 'command_line.dart' show
11 CommandLine, 11 CommandLine,
12 argumentError; 12 argumentError;
13 13
14 import 'compiler_context.dart' show
15 CompilerContext;
16
14 const Map<String, dynamic> optionSpecification = const <String, dynamic>{ 17 const Map<String, dynamic> optionSpecification = const <String, dynamic>{
15 "-o": Uri, 18 "-o": Uri,
16 "--output": Uri, 19 "--output": Uri,
17 "--platform": Uri, 20 "--platform": Uri,
18 "--packages": Uri, 21 "--packages": Uri,
22 "--fatal": ",",
19 }; 23 };
20 24
21 class CompilerCommandLine extends CommandLine { 25 class CompilerCommandLine extends CommandLine {
22 final String programName; 26 final String programName;
23 27
24 CompilerCommandLine(String programName, List<String> arguments) 28 CompilerCommandLine(String programName, List<String> arguments)
25 : programName = programName, 29 : programName = programName,
26 super(arguments, specification: optionSpecification, 30 super(arguments, specification: optionSpecification,
27 usage: computeUsage(programName, false)); 31 usage: computeUsage(programName, false));
28 32
(...skipping 29 matching lines...) Expand all
58 return options["-o"] ?? options["--output"] ?? defaultOutput; 62 return options["-o"] ?? options["--output"] ?? defaultOutput;
59 } 63 }
60 64
61 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); 65 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill");
62 66
63 Uri get platform { 67 Uri get platform {
64 return options.containsKey("--compile-sdk") 68 return options.containsKey("--compile-sdk")
65 ? null 69 ? null
66 : options["--platform"] ?? Uri.base.resolve("platform.dill"); 70 : options["--platform"] ?? Uri.base.resolve("platform.dill");
67 } 71 }
72
73 Set<String> get fatal {
74 return new Set<String>.from(options["--fatal"] ?? <String>[]);
75 }
76
77 bool get areErrorsFatal => fatal.contains("errors");
78
79 bool get areWarningsFatal => fatal.contains("warnings");
80
81 bool get areNitsFatal => fatal.contains("nits");
82
83 static dynamic withGlobalOptions(String programName, List<String> arguments,
84 dynamic f(CompilerContext context)) {
85 return CompilerContext.withGlobalOptions(
86 new CompilerCommandLine(programName, arguments), f);
87 }
88
89 static CompilerCommandLine forRootContext() {
90 return new CompilerCommandLine("", [""]);
91 }
68 } 92 }
69 93
70 String computeUsage(String programName, bool verbose) { 94 String computeUsage(String programName, bool verbose) {
71 String basicUsage = "Usage: $programName [options] dartfile\n"; 95 String basicUsage = "Usage: $programName [options] dartfile\n";
72 String summary; 96 String summary;
73 String options = (verbose ? allOptions : frequentOptions).trim(); 97 String options = (verbose ? allOptions : frequentOptions).trim();
74 switch (programName) { 98 switch (programName) {
75 case "outline": 99 case "outline":
76 summary = 100 summary =
77 "Creates an outline of a Dart program in the Dill/Kernel IR format."; 101 "Creates an outline of a Dart program in the Dill/Kernel IR format.";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 157
134 --verify 158 --verify
135 Check that the generated output is free of various problems. This is mostly 159 Check that the generated output is free of various problems. This is mostly
136 useful for developers of this compiler or Kernel transformations. 160 useful for developers of this compiler or Kernel transformations.
137 161
138 --dump-ir 162 --dump-ir
139 Print compiled libraries in Kernel source notation. 163 Print compiled libraries in Kernel source notation.
140 164
141 --compile-sdk 165 --compile-sdk
142 Compile the SDK from scratch instead of reading it from 'platform.dill'. 166 Compile the SDK from scratch instead of reading it from 'platform.dill'.
167
168 --fatal=errors
169 --fatal=warnings
170 --fatal=nits
171 Makes messages of the given kinds fatal, that is, immediately stop the
172 compiler with a non-zero exit-code. In --verbose mode, also display an
173 internal stack trace from the compiler. Multiple kinds can be separated by
174 commas, for example, --fatal=errors,warnings.
143 """; 175 """;
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/prefix_builder.dart ('k') | pkg/front_end/lib/src/fasta/compiler_context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698