remove types.TextDocument (#693)

* remove types.TextDocument

* resolve compile errors because of previous merge
This commit is contained in:
Techatrix
2022-10-01 02:45:45 +02:00
committed by GitHub
parent a8fa5c68a7
commit a9a1fad13e
10 changed files with 122 additions and 215 deletions

View File

@@ -212,14 +212,12 @@ fn writeCallNodeHint(builder: *Builder, arena: *std.heap.ArenaAllocator, store:
const start = offsets.tokenToIndex(tree, lhsToken);
const rhs_loc = offsets.tokenToLoc(tree, rhsToken);
var held_range = handle.document.borrowNullTerminatedSlice(start, rhs_loc.end);
var tokenizer = std.zig.Tokenizer.init(held_range.data());
var held_range = try arena.allocator().dupeZ(u8, handle.text[start..rhs_loc.end]);
var tokenizer = std.zig.Tokenizer.init(held_range);
// note: we have the ast node, traversing it would probably yield better results
// than trying to re-tokenize and re-parse it
errdefer held_range.release();
if (try analysis.getFieldAccessType(store, arena, handle, rhs_loc.end, &tokenizer)) |result| {
held_range.release();
const container_handle = result.unwrapped orelse result.original;
switch (container_handle.type.data) {
.other => |container_handle_node| {