Fix nullptr type
This commit is contained in:
parent
9c2f47534a
commit
8e71c6a47d
@ -6,7 +6,7 @@ fn main() {
|
|||||||
|
|
||||||
test.push(String::from(" world: "));
|
test.push(String::from(" world: "));
|
||||||
|
|
||||||
test.push_num("hello");
|
test.push_num(175);
|
||||||
|
|
||||||
print(test);
|
print(test);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr};
|
use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr, Type};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
codegen::{ErrorKind, StackValueKind},
|
codegen::{ErrorKind, StackValueKind},
|
||||||
@ -284,9 +284,15 @@ impl IntrinsicFunction for IntrinsicNullPtr {
|
|||||||
let zero = scope.block.build(Instr::Constant(ConstValue::I8(0))).unwrap();
|
let zero = scope.block.build(Instr::Constant(ConstValue::I8(0))).unwrap();
|
||||||
let instr = scope
|
let instr = scope
|
||||||
.block
|
.block
|
||||||
.build(Instr::IntToPtr(zero, self.0.get_type(scope.type_values)))
|
.build(Instr::IntToPtr(
|
||||||
|
zero,
|
||||||
|
Type::Ptr(Box::new(self.0.get_type(scope.type_values))),
|
||||||
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(StackValue(StackValueKind::Literal(instr), self.0.clone()))
|
Ok(StackValue(
|
||||||
|
StackValueKind::Literal(instr),
|
||||||
|
TypeKind::UserPtr(Box::new(self.0.clone())),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user