Chromium Code Reviews| 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:math' as math; | 9 import 'dart:math' as math; |
| 10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 } else { | 199 } else { |
| 200 throw 'Unknown kind: $kind (${kind.ordinal})'; | 200 throw 'Unknown kind: $kind (${kind.ordinal})'; |
| 201 } | 201 } |
| 202 if (!enableColors) { | 202 if (!enableColors) { |
| 203 color = (x) => x; | 203 color = (x) => x; |
| 204 } | 204 } |
| 205 if (uri == null) { | 205 if (uri == null) { |
| 206 print('${color(message)}'); | 206 print('${color(message)}'); |
| 207 } else { | 207 } else { |
| 208 SourceFile file = provider.sourceFiles[uri]; | 208 SourceFile file = provider.sourceFiles[uri]; |
| 209 if (file != null) { | 209 // TODO(johnniwinther): Remove the '.dill' hack; add support for binary |
| 210 // files to avoid crashes on trying to decode .dill binaries as utf8. | |
| 211 if (file != null && !file.filename.endsWith('.dill')) { | |
|
Siggi Cherem (dart-lang)
2017/05/19 20:09:50
eeek! but ok, I guess...
| |
| 210 print(file.getLocationMessage(color(message), begin, end, | 212 print(file.getLocationMessage(color(message), begin, end, |
| 211 colorize: color)); | 213 colorize: color)); |
| 212 } else { | 214 } else { |
| 213 String position = end - begin > 0 ? '@$begin+${end - begin}' : ''; | 215 String position = end - begin > 0 ? '@$begin+${end - begin}' : ''; |
| 214 print('${provider.relativizeUri(uri)}$position:\n' | 216 print('${provider.relativizeUri(uri)}$position:\n' |
| 215 '${color(message)}'); | 217 '${color(message)}'); |
| 216 } | 218 } |
| 217 } | 219 } |
| 218 if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) { | 220 if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) { |
| 219 isAborting = true; | 221 isAborting = true; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 resolvedUri = file; | 418 resolvedUri = file; |
| 417 break; | 419 break; |
| 418 } | 420 } |
| 419 } | 421 } |
| 420 } | 422 } |
| 421 List<int> result = await readUtf8BytesFromUri(resolvedUri); | 423 List<int> result = await readUtf8BytesFromUri(resolvedUri); |
| 422 sourceFiles[uri] = sourceFiles[resolvedUri]; | 424 sourceFiles[uri] = sourceFiles[resolvedUri]; |
| 423 return result; | 425 return result; |
| 424 } | 426 } |
| 425 } | 427 } |
| OLD | NEW |