| 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; | 7 import 'package:kernel/ast.dart' show Location; |
| 8 | 8 |
| 9 import 'util/relativize.dart' show relativizeUri; | 9 import 'util/relativize.dart' show relativizeUri; |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } else { | 74 } else { |
| 75 return message; | 75 return message; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 Location getLocation(String path, int charOffset) { | 79 Location getLocation(String path, int charOffset) { |
| 80 return CompilerContext.current.uriToSource[path] | 80 return CompilerContext.current.uriToSource[path] |
| 81 ?.getLocation(path, charOffset); | 81 ?.getLocation(path, charOffset); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Location getLocationFromUri(Uri uri, int charOffset) { |
| 85 if (charOffset == -1) return null; |
| 86 String path = relativizeUri(uri); |
| 87 return getLocation(path, charOffset); |
| 88 } |
| 89 |
| 84 String getSourceLine(Location location) { | 90 String getSourceLine(Location location) { |
| 85 if (location == null) return null; | 91 if (location == null) return null; |
| 86 return CompilerContext.current.uriToSource[location.file] | 92 return CompilerContext.current.uriToSource[location.file] |
| 87 ?.getTextLine(location.line); | 93 ?.getTextLine(location.line); |
| 88 } | 94 } |
| OLD | NEW |