OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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('dart2js'); | 5 #library('dart2js'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 #import('dart:uri'); | 8 #import('dart:uri'); |
9 #import('dart:utf'); | 9 #import('dart:utf'); |
10 | 10 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // TODO(podivilov): We should find a better way to return source maps from | 187 // TODO(podivilov): We should find a better way to return source maps from |
188 // emitter. Using diagnostic handler for that purpose is a temporary hack. | 188 // emitter. Using diagnostic handler for that purpose is a temporary hack. |
189 writeString(sourceMapOut, message); | 189 writeString(sourceMapOut, message); |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 if (isAborting) return; | 193 if (isAborting) return; |
194 isAborting = kind === api.Diagnostic.CRASH; | 194 isAborting = kind === api.Diagnostic.CRASH; |
195 bool fatal = (kind.ordinal & FATAL) != 0; | 195 bool fatal = (kind.ordinal & FATAL) != 0; |
196 bool isInfo = (kind.ordinal & INFO) != 0; | 196 bool isInfo = (kind.ordinal & INFO) != 0; |
197 if (isInfo) { | 197 if (isInfo && uri === null && kind !== api.Diagnostic.INFO) { |
198 assert(uri === null); | |
199 info(message, kind); | 198 info(message, kind); |
200 return; | 199 return; |
201 } | 200 } |
202 var color; | 201 var color; |
203 if (!enableColors) { | 202 if (!enableColors) { |
204 color = (x) => x; | 203 color = (x) => x; |
205 } else if (kind === api.Diagnostic.ERROR) { | 204 } else if (kind === api.Diagnostic.ERROR) { |
206 color = colors.red; | 205 color = colors.red; |
207 } else if (kind === api.Diagnostic.WARNING) { | 206 } else if (kind === api.Diagnostic.WARNING) { |
208 color = colors.magenta; | 207 color = colors.magenta; |
209 } else if (kind === api.Diagnostic.LINT) { | 208 } else if (kind === api.Diagnostic.LINT) { |
210 color = colors.magenta; | 209 color = colors.magenta; |
211 } else if (kind === api.Diagnostic.CRASH) { | 210 } else if (kind === api.Diagnostic.CRASH) { |
212 color = colors.red; | 211 color = colors.red; |
| 212 } else if (kind === api.Diagnostic.INFO) { |
| 213 color = colors.green; |
213 } else { | 214 } else { |
214 throw 'Unknown kind: $kind (${kind.ordinal})'; | 215 throw 'Unknown kind: $kind (${kind.ordinal})'; |
215 } | 216 } |
216 if (uri === null) { | 217 if (uri === null) { |
217 assert(fatal); | 218 assert(fatal); |
218 print(color(message)); | 219 print(color(message)); |
219 } else if (fatal || showWarnings) { | 220 } else if (fatal || showWarnings) { |
220 SourceFile file = sourceFiles[uri.toString()]; | 221 SourceFile file = sourceFiles[uri.toString()]; |
221 print(file.getLocationMessage(color(message), begin, end, true, | 222 print(file.getLocationMessage(color(message), begin, end, true, |
222 color)); | 223 color)); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } catch (var ignored) { | 375 } catch (var ignored) { |
375 print('Internal error: error while printing exception'); | 376 print('Internal error: error while printing exception'); |
376 } | 377 } |
377 try { | 378 try { |
378 print(trace); | 379 print(trace); |
379 } finally { | 380 } finally { |
380 exit(253); // 253 is recognized as a crash by our test scripts. | 381 exit(253); // 253 is recognized as a crash by our test scripts. |
381 } | 382 } |
382 } | 383 } |
383 } | 384 } |
OLD | NEW |