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

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

Issue 2770683005: Only display 'nits' in verbose mode. (Closed)
Patch Set: Rebased on master. Created 3 years, 9 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.messages; 5 library fasta.messages;
6 6
7 import 'package:kernel/ast.dart' show Location, Program; 7 import 'package:kernel/ast.dart' show Location, Program;
8 8
9 import 'util/relativize.dart' show relativizeUri; 9 import 'util/relativize.dart' show relativizeUri;
10 10
11 import 'compiler_context.dart' show CompilerContext; 11 import 'compiler_context.dart' show CompilerContext;
12 12
13 import 'errors.dart' show InputError; 13 import 'errors.dart' show InputError;
14 14
15 import 'colors.dart' show cyan, magenta; 15 import 'colors.dart' show cyan, magenta;
16 16
17 const bool hideNits = false;
18
19 const bool hideWarnings = false; 17 const bool hideWarnings = false;
20 18
21 bool get errorsAreFatal => CompilerContext.current.options.errorsAreFatal; 19 bool get errorsAreFatal => CompilerContext.current.options.errorsAreFatal;
22 20
23 bool get nitsAreFatal => CompilerContext.current.options.nitsAreFatal; 21 bool get nitsAreFatal => CompilerContext.current.options.nitsAreFatal;
24 22
25 bool get warningsAreFatal => CompilerContext.current.options.warningsAreFatal; 23 bool get warningsAreFatal => CompilerContext.current.options.warningsAreFatal;
26 24
27 bool get isVerbose => CompilerContext.current.options.verbose; 25 bool get isVerbose => CompilerContext.current.options.verbose;
28 26
27 bool get hideNits => !isVerbose;
28
29 void warning(Uri uri, int charOffset, String message) { 29 void warning(Uri uri, int charOffset, String message) {
30 if (hideWarnings) return; 30 if (hideWarnings) return;
31 print(format(uri, charOffset, colorWarning("Warning: $message"))); 31 print(format(uri, charOffset, colorWarning("Warning: $message")));
32 if (warningsAreFatal) { 32 if (warningsAreFatal) {
33 if (isVerbose) print(StackTrace.current); 33 if (isVerbose) print(StackTrace.current);
34 throw new InputError( 34 throw new InputError(
35 uri, charOffset, "Compilation aborted due to fatal warnings."); 35 uri, charOffset, "Compilation aborted due to fatal warnings.");
36 } 36 }
37 } 37 }
38 38
(...skipping 30 matching lines...) Expand all
69 } 69 }
70 } 70 }
71 71
72 Location getLocation(String path, int charOffset) { 72 Location getLocation(String path, int charOffset) {
73 if (CompilerContext.current.uriToSource[path] == null) { 73 if (CompilerContext.current.uriToSource[path] == null) {
74 return new Location(path, 1, 1); 74 return new Location(path, 1, 1);
75 } 75 }
76 return new Program(null, CompilerContext.current.uriToSource) 76 return new Program(null, CompilerContext.current.uriToSource)
77 .getLocation(path, charOffset); 77 .getLocation(path, charOffset);
78 } 78 }
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