authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-14 17:18:14+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-14 17:18:14+03:00
logc4552ee8edec961defb161e1b828a818f8d407bb
tree35812b1a33c1bc445c141cfa42cb10980a27edee
parenta32e240540895af536fdeb98db448ee745def59a
signature Commit is signed but in an unrecognized format.

store rparen in ReturnType.Invalid

This is useful for getting a partial function signature

2 files changed, 2 insertions(+), 2 deletions(-)

lib/std/zig/ast.zig+1-1
......@@ -897,7 +897,7 @@ pub const Node = struct {
897897 pub const ReturnType = union(enum) {
898898 Explicit: *Node,
899899 InferErrorSet: *Node,
900 Invalid,
900 Invalid: TokenIndex,
901901 };
902902
903903 pub fn iterate(self: *FnProto, index: usize) ?*Node {
lib/std/zig/parse.zig+1-1
......@@ -518,7 +518,7 @@ fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node {
518518 // TODO https://github.com/ziglang/zig/issues/3750
519519 const R = Node.FnProto.ReturnType;
520520 const return_type = if (return_type_expr == null)
521 R{ .Invalid = {} }
521 R{ .Invalid = rparen }
522522 else if (exclamation_token != null)
523523 R{ .InferErrorSet = return_type_expr.? }
524524 else