mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.Zig.AstGen: handle properly .inferred_ptr and .destructure in enum_literal handling
rl.resultType() returns null for inferred_ptr and destructure, so move that to the unreachable block.
This commit is contained in:
parent
14ba3bd9a1
commit
d0ba6642b5
@ -1006,9 +1006,9 @@ fn expr(gz: *GenZir, scope: *Scope, ri: ResultInfo, node: Ast.Node.Index) InnerE
|
|||||||
.field_name_start = str_index,
|
.field_name_start = str_index,
|
||||||
});
|
});
|
||||||
switch (ri.rl) {
|
switch (ri.rl) {
|
||||||
.discard, .none, .ref => unreachable, // no result type
|
.discard, .none, .ref, .inferred_ptr, .destructure => unreachable, // no result type
|
||||||
.ty, .coerced_ty => return res, // `decl_literal` does the coercion for us
|
.ty, .coerced_ty => return res, // `decl_literal` does the coercion for us
|
||||||
.ref_coerced_ty, .ptr, .inferred_ptr, .destructure => return rvalue(gz, ri, res, node),
|
.ref_coerced_ty, .ptr => return rvalue(gz, ri, res, node),
|
||||||
}
|
}
|
||||||
} else return simpleStrTok(gz, ri, tree.nodeMainToken(node), node, .enum_literal),
|
} else return simpleStrTok(gz, ri, tree.nodeMainToken(node), node, .enum_literal),
|
||||||
.error_value => return simpleStrTok(gz, ri, tree.nodeMainToken(node) + 2, node, .error_value),
|
.error_value => return simpleStrTok(gz, ri, tree.nodeMainToken(node) + 2, node, .error_value),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user