[std.zig.] parse(alloc, src) -> Ast.parse(alloc, src, Ast.Mode) (#966)
* Work in Zig's breaking changes (build sys apis) * [`std.zig.`] `parse(alloc, src)` -> `Ast.parse(alloc, src, Ast.Mode)`
This commit is contained in:
@@ -47,7 +47,7 @@ fn testNodesAtLoc(source: []const u8) !void {
|
||||
const new_source = try allocator.dupeZ(u8, ccp.new_source);
|
||||
defer allocator.free(new_source);
|
||||
|
||||
var tree = try std.zig.parse(allocator, new_source);
|
||||
var tree = try std.zig.Ast.parse(allocator, new_source, .zig);
|
||||
defer tree.deinit(allocator);
|
||||
|
||||
const nodes = try ast.nodesAtLoc(allocator, tree, inner_loc);
|
||||
|
||||
@@ -4,6 +4,8 @@ const zls = @import("zls");
|
||||
const types = zls.types;
|
||||
const offsets = zls.offsets;
|
||||
|
||||
const Ast = std.zig.Ast;
|
||||
|
||||
test "offsets - index <-> Position" {
|
||||
try testIndexPosition("", 0, 0, .{ 0, 0, 0 });
|
||||
|
||||
@@ -116,8 +118,8 @@ fn testIndexPosition(text: []const u8, index: usize, line: u32, characters: [3]u
|
||||
try std.testing.expectEqual(index, offsets.positionToIndex(text, position32, .@"utf-32"));
|
||||
}
|
||||
|
||||
fn testTokenToLoc(text: [:0]const u8, token_index: std.zig.Ast.TokenIndex, start: usize, end: usize) !void {
|
||||
var tree = try std.zig.parse(std.testing.allocator, text);
|
||||
fn testTokenToLoc(text: [:0]const u8, token_index: Ast.TokenIndex, start: usize, end: usize) !void {
|
||||
var tree = try Ast.parse(std.testing.allocator, text, .zig);
|
||||
defer tree.deinit(std.testing.allocator);
|
||||
|
||||
const actual = offsets.tokenToLoc(tree, token_index);
|
||||
|
||||
Reference in New Issue
Block a user