astgen: error on struct field with no type

This commit is contained in:
Jacob G-W 2021-06-23 09:46:50 -04:00 committed by Andrew Kelley
parent 84fe5d4681
commit 960932a4bf

View File

@ -3558,6 +3558,10 @@ fn structDeclInner(
const field_name = try astgen.identAsString(member.ast.name_token);
fields_data.appendAssumeCapacity(field_name);
if (member.ast.type_expr == 0) {
return astgen.failTok(member.ast.name_token, "struct field missing type", .{});
}
const field_type: Zir.Inst.Ref = if (node_tags[member.ast.type_expr] == .@"anytype")
.none
else