mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Make sure we reuse ASTContext in function bodies for solver-based cursor info
The main problem that prevented us from reusing the ASTContext was that we weren’t remapping the `LocToResolve` in the temporary buffer that only contains the re-parsed function back to the original buffer. Thus `NodeFinder` couldn’t find the node that we want to get cursor info for. Getting AST reuse to work for top-level items is harder because it currently heavily relies on the `HasCodeCompletion` state being set on the parser result. I’ll try that in a follow-up PR. rdar://103251263
This commit is contained in:
@@ -166,6 +166,17 @@ public:
|
||||
|
||||
SourceLoc getIDEInspectionTargetLoc() const;
|
||||
|
||||
/// Returns whether `Range` contains `Loc`. This also respects the
|
||||
/// `ReplacedRanges`, i.e. if `Loc` is in a range that replaces a range which
|
||||
/// overlaps `Range`, this also returns `true`.
|
||||
bool containsRespectingReplacedRanges(SourceRange Range, SourceLoc Loc) const;
|
||||
|
||||
/// Returns whether `Enclosing` contains `Inner`. This also respects the
|
||||
/// `ReplacedRanges`, i.e. if `Inner` is contained in a range that replaces a
|
||||
/// range which overlaps `Range`, this also returns `true`.
|
||||
bool rangeContainsRespectingReplacedRanges(SourceRange Enclosing,
|
||||
SourceRange Inner) const;
|
||||
|
||||
const llvm::DenseMap<SourceRange, SourceRange> &getReplacedRanges() const {
|
||||
return ReplacedRanges;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user