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) { | |
ahe
2017/06/19 14:33:06
if (charOffset == -1) return null;
jensj
2017/06/20 11:24:49
Done.
| |
85 String path = relativizeUri(uri); | |
86 return getLocation(path, charOffset); | |
87 } | |
88 | |
84 String getSourceLine(Location location) { | 89 String getSourceLine(Location location) { |
85 if (location == null) return null; | 90 if (location == null) return null; |
86 return CompilerContext.current.uriToSource[location.file] | 91 return CompilerContext.current.uriToSource[location.file] |
87 ?.getTextLine(location.line); | 92 ?.getTextLine(location.line); |
88 } | 93 } |
OLD | NEW |