| 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 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 void diagnosticHandler(Uri uri, int begin, int end, String message, | 109 void diagnosticHandler(Uri uri, int begin, int end, String message, |
| 110 api.Diagnostic kind) { | 110 api.Diagnostic kind) { |
| 111 // TODO(ahe): Remove this when source map is handled differently. | 111 // TODO(ahe): Remove this when source map is handled differently. |
| 112 if (identical(kind.name, 'source map')) return; | 112 if (identical(kind.name, 'source map')) return; |
| 113 | 113 |
| 114 if (isAborting) return; | 114 if (isAborting) return; |
| 115 isAborting = (kind == api.Diagnostic.CRASH); | 115 isAborting = (kind == api.Diagnostic.CRASH); |
| 116 | 116 |
| 117 message = prefixMessage(message, kind); | |
| 118 | |
| 119 bool fatal = (kind.ordinal & FATAL) != 0; | 117 bool fatal = (kind.ordinal & FATAL) != 0; |
| 120 bool isInfo = (kind.ordinal & INFO) != 0; | 118 bool isInfo = (kind.ordinal & INFO) != 0; |
| 121 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { | 119 if (isInfo && uri == null && kind != api.Diagnostic.INFO) { |
| 122 info(message, kind); | 120 info(message, kind); |
| 123 return; | 121 return; |
| 124 } | 122 } |
| 123 |
| 124 message = prefixMessage(message, kind); |
| 125 |
| 125 // [previousKind]/[lastKind] records the previous non-INFO kind we saw. | 126 // [previousKind]/[lastKind] records the previous non-INFO kind we saw. |
| 126 // This is used to suppress info about a warning when warnings are | 127 // This is used to suppress info about a warning when warnings are |
| 127 // suppressed, and similar for hints. | 128 // suppressed, and similar for hints. |
| 128 var previousKind = lastKind; | 129 var previousKind = lastKind; |
| 129 if (kind != api.Diagnostic.INFO) { | 130 if (kind != api.Diagnostic.INFO) { |
| 130 lastKind = kind; | 131 lastKind = kind; |
| 131 } | 132 } |
| 132 var color; | 133 var color; |
| 133 if (kind == api.Diagnostic.ERROR) { | 134 if (kind == api.Diagnostic.ERROR) { |
| 134 color = colors.red; | 135 color = colors.red; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 163 if (fatal && throwOnError) { | 164 if (fatal && throwOnError) { |
| 164 isAborting = true; | 165 isAborting = true; |
| 165 throw new AbortLeg(message); | 166 throw new AbortLeg(message); |
| 166 } | 167 } |
| 167 } | 168 } |
| 168 | 169 |
| 169 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { | 170 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { |
| 170 return diagnosticHandler(uri, begin, end, message, kind); | 171 return diagnosticHandler(uri, begin, end, message, kind); |
| 171 } | 172 } |
| 172 } | 173 } |
| OLD | NEW |