| 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:io'; | 8 import 'dart:io'; |
| 9 import 'dart:utf'; | 9 import 'dart:utf'; |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool fatal = (kind.ordinal & FATAL) != 0; | 87 bool fatal = (kind.ordinal & FATAL) != 0; |
| 88 bool isInfo = (kind.ordinal & INFO) != 0; | 88 bool isInfo = (kind.ordinal & INFO) != 0; |
| 89 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { | 89 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { |
| 90 info(message, kind); | 90 info(message, kind); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 // [previousKind]/[lastKind] records the previous non-INFO kind we saw. | 93 // [previousKind]/[lastKind] records the previous non-INFO kind we saw. |
| 94 // This is used to suppress info about a warning when warnings are | 94 // This is used to suppress info about a warning when warnings are |
| 95 // suppressed, and similar for hints. | 95 // suppressed, and similar for hints. |
| 96 var previousKind = lastKind; | 96 var previousKind = lastKind; |
| 97 if (previousKind != api.Diagnostic.INFO) { | 97 if (kind != api.Diagnostic.INFO) { |
| 98 lastKind = kind; | 98 lastKind = kind; |
| 99 } | 99 } |
| 100 var color; | 100 var color; |
| 101 if (kind == api.Diagnostic.ERROR) { | 101 if (kind == api.Diagnostic.ERROR) { |
| 102 color = colors.red; | 102 color = colors.red; |
| 103 } else if (kind == api.Diagnostic.WARNING) { | 103 } else if (kind == api.Diagnostic.WARNING) { |
| 104 if (!showWarnings) return; | 104 if (!showWarnings) return; |
| 105 color = colors.magenta; | 105 color = colors.magenta; |
| 106 } else if (kind == api.Diagnostic.HINT) { | 106 } else if (kind == api.Diagnostic.HINT) { |
| 107 if (!showHints) return; | 107 if (!showHints) return; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 131 if (fatal && throwOnError) { | 131 if (fatal && throwOnError) { |
| 132 isAborting = true; | 132 isAborting = true; |
| 133 throw new AbortLeg(message); | 133 throw new AbortLeg(message); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { | 137 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { |
| 138 return diagnosticHandler(uri, begin, end, message, kind); | 138 return diagnosticHandler(uri, begin, end, message, kind); |
| 139 } | 139 } |
| 140 } | 140 } |
| OLD | NEW |