remove unused capacity from Ast and DocumentStore (#941)
This commit is contained in:
parent
6019eff13e
commit
e055f9d15c
@ -622,9 +622,19 @@ fn createDocument(self: *DocumentStore, uri: Uri, text: [:0]u8, open: bool) erro
|
|||||||
var tree = try std.zig.parse(self.allocator, text);
|
var tree = try std.zig.parse(self.allocator, text);
|
||||||
errdefer tree.deinit(self.allocator);
|
errdefer tree.deinit(self.allocator);
|
||||||
|
|
||||||
|
var nodes = tree.nodes.toMultiArrayList();
|
||||||
|
try nodes.setCapacity(self.allocator, nodes.len);
|
||||||
|
tree.nodes = nodes.slice();
|
||||||
|
|
||||||
|
var tokens = tree.tokens.toMultiArrayList();
|
||||||
|
try tokens.setCapacity(self.allocator, tokens.len);
|
||||||
|
tree.tokens = tokens.slice();
|
||||||
|
|
||||||
var document_scope = try analysis.makeDocumentScope(self.allocator, tree);
|
var document_scope = try analysis.makeDocumentScope(self.allocator, tree);
|
||||||
errdefer document_scope.deinit(self.allocator);
|
errdefer document_scope.deinit(self.allocator);
|
||||||
|
|
||||||
|
try document_scope.scopes.setCapacity(self.allocator, document_scope.scopes.len);
|
||||||
|
|
||||||
break :blk Handle{
|
break :blk Handle{
|
||||||
.open = open,
|
.open = open,
|
||||||
.uri = duped_uri,
|
.uri = duped_uri,
|
||||||
|
Loading…
Reference in New Issue
Block a user