mirror of
https://github.com/ziglang/zig.git
synced 2026-02-07 23:17:17 +00:00
stage2 astgen: fix bug in struct init where type not refed
This commit is contained in:
parent
75f7a8913e
commit
2092481265
@ -1328,6 +1328,8 @@ fn structInitExpr(
|
||||
}
|
||||
switch (rl) {
|
||||
.discard => {
|
||||
if (struct_init.ast.type_expr != 0)
|
||||
_ = try typeExpr(gz, scope, struct_init.ast.type_expr);
|
||||
for (struct_init.ast.fields) |field_init| {
|
||||
_ = try expr(gz, scope, .discard, field_init);
|
||||
}
|
||||
@ -1412,6 +1414,9 @@ fn structInitExprRlPtr(
|
||||
const field_ptr_list = try gpa.alloc(Zir.Inst.Index, struct_init.ast.fields.len);
|
||||
defer gpa.free(field_ptr_list);
|
||||
|
||||
if (struct_init.ast.type_expr != 0)
|
||||
_ = try typeExpr(gz, scope, struct_init.ast.type_expr);
|
||||
|
||||
for (struct_init.ast.fields) |field_init, i| {
|
||||
const name_token = tree.firstToken(field_init) - 2;
|
||||
const str_index = try astgen.identAsString(name_token);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user