| ... | @@ -1281,6 +1281,7 @@ fn blockExprStmts( | ... | @@ -1281,6 +1281,7 @@ fn blockExprStmts( |
| 1281 | .bit_or, | 1281 | .bit_or, |
| 1282 | .block, | 1282 | .block, |
| 1283 | .block_inline, | 1283 | .block_inline, |
| | 1284 | .block_inline_var, |
| 1284 | .loop, | 1285 | .loop, |
| 1285 | .bool_br_and, | 1286 | .bool_br_and, |
| 1286 | .bool_br_or, | 1287 | .bool_br_or, |
| ... | @@ -2020,7 +2021,7 @@ fn fnDecl( | ... | @@ -2020,7 +2021,7 @@ fn fnDecl( |
| 2020 | // Iterate over the parameters. We put the param names as the first N | 2021 | // Iterate over the parameters. We put the param names as the first N |
| 2021 | // items inside `extra` so that debug info later can refer to the parameter names | 2022 | // items inside `extra` so that debug info later can refer to the parameter names |
| 2022 | // even while the respective source code is unloaded. | 2023 | // even while the respective source code is unloaded. |
| 2023 | try astgen.extra.ensureCapacity(gpa, param_count); | 2024 | try astgen.extra.ensureUnusedCapacity(gpa, param_count); |
| 2024 | | 2025 | |
| 2025 | { | 2026 | { |
| 2026 | var params_scope = &fn_gz.base; | 2027 | var params_scope = &fn_gz.base; |
| ... | @@ -2080,7 +2081,7 @@ fn fnDecl( | ... | @@ -2080,7 +2081,7 @@ fn fnDecl( |
| 2080 | }; | 2081 | }; |
| 2081 | | 2082 | |
| 2082 | const fn_name_token = fn_proto.name_token orelse { | 2083 | const fn_name_token = fn_proto.name_token orelse { |
| 2083 | @panic("TODO handle missing function names in the parser"); | 2084 | return astgen.failTok(fn_proto.ast.fn_token, "missing function name", .{}); |
| 2084 | }; | 2085 | }; |
| 2085 | const fn_name_str_index = try gz.identAsString(fn_name_token); | 2086 | const fn_name_str_index = try gz.identAsString(fn_name_token); |
| 2086 | | 2087 | |
| ... | @@ -2173,16 +2174,13 @@ fn globalVarDecl( | ... | @@ -2173,16 +2174,13 @@ fn globalVarDecl( |
| 2173 | var_decl.ast.init_node, | 2174 | var_decl.ast.init_node, |
| 2174 | ); | 2175 | ); |
| 2175 | | 2176 | |
| 2176 | if (!is_mutable) { | 2177 | const tag: Zir.Inst.Tag = if (is_mutable) .block_inline_var else .block_inline; |
| 2177 | // const globals are just their instruction. mutable globals have | 2178 | // const globals are just their instruction. mutable globals have |
| 2178 | // a special ZIR form. | 2179 | // a special ZIR form. |
| 2179 | const block_inst = try gz.addBlock(.block_inline, node); | 2180 | const block_inst = try gz.addBlock(tag, node); |
| 2180 | _ = try block_scope.addBreak(.break_inline, block_inst, init_inst); | 2181 | _ = try block_scope.addBreak(.break_inline, block_inst, init_inst); |
| 2181 | try block_scope.setBlockBody(block_inst); | 2182 | try block_scope.setBlockBody(block_inst); |
| 2182 | break :vi block_inst; | 2183 | break :vi block_inst; |
| 2183 | } | | |
| 2184 | | | |
| 2185 | @panic("TODO astgen global variable"); | | |
| 2186 | } else if (!is_extern) { | 2184 | } else if (!is_extern) { |
| 2187 | return astgen.failNode(node, "variables must be initialized", .{}); | 2185 | return astgen.failNode(node, "variables must be initialized", .{}); |
| 2188 | } else if (var_decl.ast.type_node != 0) { | 2186 | } else if (var_decl.ast.type_node != 0) { |
| ... | @@ -2190,7 +2188,7 @@ fn globalVarDecl( | ... | @@ -2190,7 +2188,7 @@ fn globalVarDecl( |
| 2190 | | 2188 | |
| 2191 | const type_inst = try typeExpr(gz, scope, var_decl.ast.type_node); | 2189 | const type_inst = try typeExpr(gz, scope, var_decl.ast.type_node); |
| 2192 | | 2190 | |
| 2193 | @panic("TODO AstGen extern global variable"); | 2191 | return astgen.failNode(node, "TODO AstGen extern global variable", .{}); |
| 2194 | } else { | 2192 | } else { |
| 2195 | return astgen.failNode(node, "unable to infer variable type", .{}); | 2193 | return astgen.failNode(node, "unable to infer variable type", .{}); |
| 2196 | }; | 2194 | }; |
| ... | @@ -2588,7 +2586,7 @@ fn containerDecl( | ... | @@ -2588,7 +2586,7 @@ fn containerDecl( |
| 2588 | ); | 2586 | ); |
| 2589 | } | 2587 | } |
| 2590 | if (counts.values == 0 and counts.decls == 0 and arg_inst == .none) { | 2588 | if (counts.values == 0 and counts.decls == 0 and arg_inst == .none) { |
| 2591 | @panic("AstGen simple enum"); | 2589 | return astgen.failNode(node, "TODO AstGen simple enums", .{}); |
| 2592 | } | 2590 | } |
| 2593 | // In this case we must generate ZIR code for the tag values, similar to | 2591 | // In this case we must generate ZIR code for the tag values, similar to |
| 2594 | // how structs are handled above. | 2592 | // how structs are handled above. |
| ... | @@ -2698,7 +2696,7 @@ fn errorSetDecl( | ... | @@ -2698,7 +2696,7 @@ fn errorSetDecl( |
| 2698 | const main_tokens = tree.nodes.items(.main_token); | 2696 | const main_tokens = tree.nodes.items(.main_token); |
| 2699 | const token_tags = tree.tokens.items(.tag); | 2697 | const token_tags = tree.tokens.items(.tag); |
| 2700 | | 2698 | |
| 2701 | @panic("TODO AstGen errorSetDecl"); | 2699 | return astgen.failNode(node, "TODO AstGen errorSetDecl", .{}); |
| 2702 | } | 2700 | } |
| 2703 | | 2701 | |
| 2704 | fn orelseCatchExpr( | 2702 | fn orelseCatchExpr( |