OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 source_file_provider; | 5 library source_file_provider; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { | 169 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { |
170 info(message, kind); | 170 info(message, kind); |
171 return; | 171 return; |
172 } | 172 } |
173 | 173 |
174 message = prefixMessage(message, kind); | 174 message = prefixMessage(message, kind); |
175 | 175 |
176 // [lastKind] records the previous non-INFO kind we saw. | 176 // [lastKind] records the previous non-INFO kind we saw. |
177 // This is used to suppress info about a warning when warnings are | 177 // This is used to suppress info about a warning when warnings are |
178 // suppressed, and similar for hints. | 178 // suppressed, and similar for hints. |
179 if (kind != api.Diagnostic.INFO) { | 179 if (kind != api.Diagnostic.INFO) { |
180 lastKind = kind; | 180 lastKind = kind; |
181 } | 181 } |
182 var color; | 182 var color; |
183 if (kind == api.Diagnostic.ERROR) { | 183 if (kind == api.Diagnostic.ERROR) { |
184 color = colors.red; | 184 color = colors.red; |
185 } else if (kind == api.Diagnostic.WARNING) { | 185 } else if (kind == api.Diagnostic.WARNING) { |
186 if (!showWarnings) return; | 186 if (!showWarnings) return; |
187 color = colors.magenta; | 187 color = colors.magenta; |
188 } else if (kind == api.Diagnostic.HINT) { | 188 } else if (kind == api.Diagnostic.HINT) { |
189 if (!showHints) return; | 189 if (!showHints) return; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 var onAdd, onClose; | 321 var onAdd, onClose; |
322 | 322 |
323 EventSinkWrapper(this.onAdd, this.onClose); | 323 EventSinkWrapper(this.onAdd, this.onClose); |
324 | 324 |
325 void add(String data) => onAdd(data); | 325 void add(String data) => onAdd(data); |
326 | 326 |
327 void addError(error, [StackTrace stackTrace]) => throw error; | 327 void addError(error, [StackTrace stackTrace]) => throw error; |
328 | 328 |
329 void close() => onClose(); | 329 void close() => onClose(); |
330 } | 330 } |
OLD | NEW |