Fix calling convention for integers/real-numbers

This commit is contained in:
Sofia 2025-08-04 16:00:01 +03:00
parent 5d19d38682
commit ae6796acfc
3 changed files with 8 additions and 3 deletions

View File

@ -491,7 +491,7 @@ impl IntrinsicFunction for IntrinsicLLVM {
))
.unwrap();
Ok(StackValue(StackValueKind::Literal(value), self.1))
Ok(StackValue(StackValueKind::Literal(value), self.1.clone()))
}
}

View File

@ -134,8 +134,6 @@ pub fn compile_module<'map>(
is_main,
};
dbg!(&ast_module);
if errors.len() > 0 {
// dbg!(&ast_module);
return Ok(Err((

View File

@ -12,6 +12,7 @@ use std::{
use crate::{
mir::{
implement::TypeCategory,
pass::{AssociatedFunctionKey, ScopeVariable},
BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind,
IfExpression, Module, ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement,
@ -627,12 +628,18 @@ impl Expression {
if backing_var.is_some() {
if let TypeKind::Borrow(inner, _) = type_kind {
let ty_cat = inner.category();
if let TypeKind::Borrow(..) = *inner.clone() {
*type_kind = type_kind.unroll_borrow();
let ExprKind::Borrow(val, _) = &first_param.0 else {
panic!()
};
*first_param = *val.clone();
} else if ty_cat == TypeCategory::Integer || ty_cat == TypeCategory::Real {
if let ExprKind::Borrow(val, _) = &first_param.0 {
*first_param = *val.clone();
}
*type_kind = *inner.clone();
}
}
} else {