From ab4631f7844c7bdf7fec2e3b8d40cb966c130d30 Mon Sep 17 00:00:00 2001 From: Vic Nightfall Date: Sun, 28 Apr 2024 15:51:19 +0200 Subject: [PATCH] Update --- src/compiler.pr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler.pr b/src/compiler.pr index 3754e29..11bc686 100644 --- a/src/compiler.pr +++ b/src/compiler.pr @@ -4293,8 +4293,8 @@ def walk_AlignOf(node: &parser::Node, state: &State) -> Value { return value } -def convert_ref_to_int(node: &parser::Node, value: Value, loc: &Value, state: &State) -> Value { - let gep_ret = state.extract_value(pointer(value.tpe.tpe), value, [1], loc) +def convert_ref_to_int(value: Value, loc: &Value, state: &State) -> Value { + let gep_ret = convert_ref_to_ptr(pointer(value.tpe.tpe if value.tpe.tpe else builtins::int8_), value, loc, state) return state.ptr_to_int(gep_ret, loc) } @@ -4406,10 +4406,10 @@ def compare(node: &parser::Node, left: Value, right: Value, state: &State) -> Va right = convert_to(node, right, builtins::size_t_, state) } if typechecking::is_ref_or_weak(left.tpe) { - left = convert_ref_to_int(node, left, loc, state) + left = convert_ref_to_int(left, loc, state) } if typechecking::is_ref_or_weak(right.tpe) { - right = convert_ref_to_int(node, right, loc, state) + right = convert_ref_to_int(right, loc, state) } if (@left.tpe).kind == typechecking::TypeKind::NULL { left = make_int_value(0)