| ... | @@ -55,6 +55,7 @@ pub const Node = struct { | ... | @@ -55,6 +55,7 @@ pub const Node = struct { |
| 55 | AsmOutput, | 55 | AsmOutput, |
| 56 | Unreachable, | 56 | Unreachable, |
| 57 | ErrorType, | 57 | ErrorType, |
| | 58 | VarType, |
| 58 | BuiltinCall, | 59 | BuiltinCall, |
| 59 | LineComment, | 60 | LineComment, |
| 60 | TestDecl, | 61 | TestDecl, |
| ... | @@ -108,6 +109,7 @@ pub const Node = struct { | ... | @@ -108,6 +109,7 @@ pub const Node = struct { |
| 108 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).iterate(index), | 109 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).iterate(index), |
| 109 | Id.Unreachable => @fieldParentPtr(NodeUnreachable, "base", base).iterate(index), | 110 | Id.Unreachable => @fieldParentPtr(NodeUnreachable, "base", base).iterate(index), |
| 110 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).iterate(index), | 111 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).iterate(index), |
| | 112 | Id.VarType => @fieldParentPtr(NodeVarType, "base", base).iterate(index), |
| 111 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).iterate(index), | 113 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).iterate(index), |
| 112 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).iterate(index), | 114 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).iterate(index), |
| 113 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).iterate(index), | 115 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).iterate(index), |
| ... | @@ -162,6 +164,7 @@ pub const Node = struct { | ... | @@ -162,6 +164,7 @@ pub const Node = struct { |
| 162 | Id.AsmInput => @fieldParentPtr(NodeAsmInput, "base", base).firstToken(), | 164 | Id.AsmInput => @fieldParentPtr(NodeAsmInput, "base", base).firstToken(), |
| 163 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).firstToken(), | 165 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).firstToken(), |
| 164 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).firstToken(), | 166 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).firstToken(), |
| | 167 | Id.VarType => @fieldParentPtr(NodeVarType, "base", base).firstToken(), |
| 165 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).firstToken(), | 168 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).firstToken(), |
| 166 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).firstToken(), | 169 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).firstToken(), |
| 167 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).firstToken(), | 170 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).firstToken(), |
| ... | @@ -216,6 +219,7 @@ pub const Node = struct { | ... | @@ -216,6 +219,7 @@ pub const Node = struct { |
| 216 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).lastToken(), | 219 | Id.AsmOutput => @fieldParentPtr(NodeAsmOutput, "base", base).lastToken(), |
| 217 | Id.Unreachable => @fieldParentPtr(NodeUnreachable, "base", base).lastToken(), | 220 | Id.Unreachable => @fieldParentPtr(NodeUnreachable, "base", base).lastToken(), |
| 218 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).lastToken(), | 221 | Id.ErrorType => @fieldParentPtr(NodeErrorType, "base", base).lastToken(), |
| | 222 | Id.VarType => @fieldParentPtr(NodeVarType, "base", base).lastToken(), |
| 219 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).lastToken(), | 223 | Id.BuiltinCall => @fieldParentPtr(NodeBuiltinCall, "base", base).lastToken(), |
| 220 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).lastToken(), | 224 | Id.LineComment => @fieldParentPtr(NodeLineComment, "base", base).lastToken(), |
| 221 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).lastToken(), | 225 | Id.TestDecl => @fieldParentPtr(NodeTestDecl, "base", base).lastToken(), |
| ... | @@ -541,7 +545,6 @@ pub const NodeFnProto = struct { | ... | @@ -541,7 +545,6 @@ pub const NodeFnProto = struct { |
| 541 | | 545 | |
| 542 | pub const ReturnType = union(enum) { | 546 | pub const ReturnType = union(enum) { |
| 543 | Explicit: &Node, | 547 | Explicit: &Node, |
| 544 | Infer: Token, | | |
| 545 | InferErrorSet: &Node, | 548 | InferErrorSet: &Node, |
| 546 | }; | 549 | }; |
| 547 | | 550 | |
| ... | @@ -597,7 +600,6 @@ pub const NodeFnProto = struct { | ... | @@ -597,7 +600,6 @@ pub const NodeFnProto = struct { |
| 597 | // TODO allow this and next prong to share bodies since the types are the same | 600 | // TODO allow this and next prong to share bodies since the types are the same |
| 598 | ReturnType.Explicit => |node| return node.lastToken(), | 601 | ReturnType.Explicit => |node| return node.lastToken(), |
| 599 | ReturnType.InferErrorSet => |node| return node.lastToken(), | 602 | ReturnType.InferErrorSet => |node| return node.lastToken(), |
| 600 | ReturnType.Infer => |token| return token, | | |
| 601 | } | 603 | } |
| 602 | } | 604 | } |
| 603 | }; | 605 | }; |
| ... | @@ -1788,6 +1790,23 @@ pub const NodeErrorType = struct { | ... | @@ -1788,6 +1790,23 @@ pub const NodeErrorType = struct { |
| 1788 | } | 1790 | } |
| 1789 | }; | 1791 | }; |
| 1790 | | 1792 | |
| | 1793 | pub const NodeVarType = struct { |
| | 1794 | base: Node, |
| | 1795 | token: Token, |
| | 1796 | |
| | 1797 | pub fn iterate(self: &NodeVarType, index: usize) ?&Node { |
| | 1798 | return null; |
| | 1799 | } |
| | 1800 | |
| | 1801 | pub fn firstToken(self: &NodeVarType) Token { |
| | 1802 | return self.token; |
| | 1803 | } |
| | 1804 | |
| | 1805 | pub fn lastToken(self: &NodeVarType) Token { |
| | 1806 | return self.token; |
| | 1807 | } |
| | 1808 | }; |
| | 1809 | |
| 1791 | pub const NodeLineComment = struct { | 1810 | pub const NodeLineComment = struct { |
| 1792 | base: Node, | 1811 | base: Node, |
| 1793 | lines: ArrayList(Token), | 1812 | lines: ArrayList(Token), |