mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Fixed comparison against nil for maps
This commit is contained in:
@@ -2724,18 +2724,13 @@ lbValue lb_emit_comp_against_nil(lbProcedure *p, TokenKind op_kind, lbValue x) {
|
|||||||
|
|
||||||
case Type_Map:
|
case Type_Map:
|
||||||
{
|
{
|
||||||
lbValue map_ptr = lb_address_from_load_or_generate_local(p, x);
|
lbValue data_ptr = lb_emit_struct_ev(p, x, 0);
|
||||||
|
|
||||||
unsigned indices[2] = {0, 0};
|
|
||||||
lbValue hashes_data = lb_emit_struct_ep(p, map_ptr, 0);
|
|
||||||
lbValue hashes_data_ptr_ptr = lb_emit_struct_ep(p, hashes_data, 0);
|
|
||||||
LLVMValueRef hashes_data_ptr = LLVMBuildLoad2(p->builder, llvm_addr_type(p->module, hashes_data_ptr_ptr), hashes_data_ptr_ptr.value, "");
|
|
||||||
|
|
||||||
if (op_kind == Token_CmpEq) {
|
if (op_kind == Token_CmpEq) {
|
||||||
res.value = LLVMBuildIsNull(p->builder, hashes_data_ptr, "");
|
res.value = LLVMBuildIsNull(p->builder, data_ptr.value, "");
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
res.value = LLVMBuildIsNotNull(p->builder, hashes_data_ptr, "");
|
res.value = LLVMBuildIsNotNull(p->builder, data_ptr.value, "");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user