diff options
| author | Vexu <git@vexu.eu> | 2020-05-14 17:18:14 +0300 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-05-14 17:18:14 +0300 |
| commit | c4552ee8edec961defb161e1b828a818f8d407bb (patch) | |
| tree | 35812b1a33c1bc445c141cfa42cb10980a27edee /lib | |
| parent | a32e240540895af536fdeb98db448ee745def59a (diff) | |
| download | zig-c4552ee8edec961defb161e1b828a818f8d407bb.tar.gz zig-c4552ee8edec961defb161e1b828a818f8d407bb.zip | |
store rparen in ReturnType.Invalid
This is useful for getting a partial function signature
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/zig/ast.zig | 2 | ||||
| -rw-r--r-- | lib/std/zig/parse.zig | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/zig/ast.zig b/lib/std/zig/ast.zig index 6fb1ce012b..351162bec0 100644 --- a/lib/std/zig/ast.zig +++ b/lib/std/zig/ast.zig @@ -897,7 +897,7 @@ pub const Node = struct { pub const ReturnType = union(enum) { Explicit: *Node, InferErrorSet: *Node, - Invalid, + Invalid: TokenIndex, }; pub fn iterate(self: *FnProto, index: usize) ?*Node { diff --git a/lib/std/zig/parse.zig b/lib/std/zig/parse.zig index b4b80669a1..98b1e9d329 100644 --- a/lib/std/zig/parse.zig +++ b/lib/std/zig/parse.zig @@ -518,7 +518,7 @@ fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { // TODO https://github.com/ziglang/zig/issues/3750 const R = Node.FnProto.ReturnType; const return_type = if (return_type_expr == null) - R{ .Invalid = {} } + R{ .Invalid = rparen } else if (exclamation_token != null) R{ .InferErrorSet = return_type_expr.? } else |
