No types, no fucking types. Just bugs
This commit is contained in:
@@ -189,7 +189,7 @@ fn zigNode(token: c_uint) Ast.Node.Tag {
|
||||
// zigAst converts a c.Ast to std.Zig.Ast. The resulting Ast should be freed with deinit().
|
||||
fn zigAst(gpa: Allocator, c_ast: c.Ast) !Ast {
|
||||
var tokens = Ast.TokenList{};
|
||||
try tokens.ensureTotalCapacity(gpa, c_ast.tokens.len);
|
||||
try tokens.resize(gpa, c_ast.tokens.len);
|
||||
errdefer tokens.deinit(gpa);
|
||||
|
||||
for (0..c_ast.tokens.len) |i|
|
||||
@@ -199,7 +199,7 @@ fn zigAst(gpa: Allocator, c_ast: c.Ast) !Ast {
|
||||
});
|
||||
|
||||
var nodes = Ast.NodeList{};
|
||||
try nodes.ensureTotalCapacity(gpa, c_ast.nodes.len);
|
||||
try nodes.resize(gpa, c_ast.nodes.len);
|
||||
errdefer nodes.deinit(gpa);
|
||||
|
||||
for (0..c_ast.nodes.len) |i|
|
||||
@@ -250,7 +250,8 @@ fn testParse(source: [:0]const u8, allocator: mem.Allocator, anything_changed: *
|
||||
const stderr = io.getStdErr().writer();
|
||||
|
||||
//var tree = try std.zig.Ast.parse(allocator, source, .zig);
|
||||
const c_tree = c.astParse(source, @intCast(source.len));
|
||||
var c_tree = c.astParse(source, @intCast(source.len));
|
||||
defer c.astDeinit(&c_tree);
|
||||
var tree = try zigAst(allocator, c_tree);
|
||||
defer tree.deinit(allocator);
|
||||
|
||||
@@ -300,8 +301,6 @@ fn testCanonical(source: [:0]const u8) !void {
|
||||
}
|
||||
|
||||
test "zig fmt: remove extra whitespace at start and end of file with comment between" {
|
||||
if (true) return error.SkipZigTest;
|
||||
|
||||
try testTransform(
|
||||
\\
|
||||
\\
|
||||
@@ -313,3 +312,12 @@ test "zig fmt: remove extra whitespace at start and end of file with comment bet
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "my function" {
|
||||
try testCanonical(
|
||||
\\pub fn main() void {
|
||||
\\ @panic("hello");
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user