Merge pull request #39 from alexnask/master

Fixed build with newest zig parser fixes.
This commit is contained in:
Auguste Rame 2020-05-16 10:31:32 -04:00 committed by GitHub
commit afc85fa964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,13 +120,12 @@ pub fn getFunctionSnippet(allocator: *std.mem.Allocator, tree: *ast.Tree, func:
try buffer.appendSlice(": "); try buffer.appendSlice(": ");
} }
if (param_decl.var_args_token) |_| { switch (param_decl.param_type) {
try buffer.appendSlice("..."); .var_args => try buffer.appendSlice("..."),
continue; .var_type => try buffer.appendSlice("var"),
} .type_expr => |type_expr| {
var curr_tok = type_expr.firstToken();
var curr_tok = param_decl.type_node.firstToken(); var end_tok = type_expr.lastToken();
var end_tok = param_decl.type_node.lastToken();
while (curr_tok <= end_tok) : (curr_tok += 1) { while (curr_tok <= end_tok) : (curr_tok += 1) {
const id = tree.tokens.at(curr_tok).id; const id = tree.tokens.at(curr_tok).id;
const is_comma = tree.tokens.at(curr_tok).id == .Comma; const is_comma = tree.tokens.at(curr_tok).id == .Comma;
@ -136,6 +135,8 @@ pub fn getFunctionSnippet(allocator: *std.mem.Allocator, tree: *ast.Tree, func:
try buffer.appendSlice(tree.tokenSlice(curr_tok)); try buffer.appendSlice(tree.tokenSlice(curr_tok));
if (is_comma or id == .Keyword_const) try buffer.append(' '); if (is_comma or id == .Keyword_const) try buffer.append(' ');
} }
}
}
try buffer.append('}'); try buffer.append('}');
} }