| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.messages; | 5 library fasta.messages; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' show Location, Program; | 7 import 'package:kernel/ast.dart' show Location, Program; |
| 8 | 8 |
| 9 import 'util/relativize.dart' show relativizeUri; | 9 import 'util/relativize.dart' show relativizeUri; |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 String path = relativizeUri(uri); | 63 String path = relativizeUri(uri); |
| 64 String position = | 64 String position = |
| 65 charOffset == -1 ? path : "${getLocation(path, charOffset)}"; | 65 charOffset == -1 ? path : "${getLocation(path, charOffset)}"; |
| 66 return "$position: $message"; | 66 return "$position: $message"; |
| 67 } else { | 67 } else { |
| 68 return message; | 68 return message; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 Location getLocation(String path, int charOffset) { | 72 Location getLocation(String path, int charOffset) { |
| 73 if (CompilerContext.current.uriToSource[path] == null) { |
| 74 return new Location(path, 1, 1); |
| 75 } |
| 73 return new Program(null, CompilerContext.current.uriToSource) | 76 return new Program(null, CompilerContext.current.uriToSource) |
| 74 .getLocation(path, charOffset); | 77 .getLocation(path, charOffset); |
| 75 } | 78 } |
| OLD | NEW |