Make param mutable based on type
This commit is contained in:
parent
60818842a5
commit
b9f6f2ba0f
@ -367,7 +367,7 @@ impl mir::Module {
|
||||
stack_values.insert(
|
||||
p_name.clone(),
|
||||
StackValue(
|
||||
StackValueKind::Mutable(alloca),
|
||||
StackValueKind::mutable(p_ty.is_mutable(), alloca),
|
||||
TypeKind::Ptr(Box::new(p_ty.clone())),
|
||||
),
|
||||
);
|
||||
|
@ -75,8 +75,8 @@ impl TypeKind {
|
||||
|
||||
pub fn is_mutable(&self) -> bool {
|
||||
match self {
|
||||
TypeKind::Borrow(_, true) => true,
|
||||
_ => false,
|
||||
TypeKind::Borrow(_, false) => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ impl FunctionDefinition {
|
||||
.set(
|
||||
param.0.clone(),
|
||||
ScopeVariable {
|
||||
ty: param_t,
|
||||
mutable: true,
|
||||
ty: param_t.clone(),
|
||||
mutable: param_t.is_mutable(),
|
||||
},
|
||||
)
|
||||
.or(Err(ErrorKind::VariableAlreadyDefined(param.0.clone())));
|
||||
|
Loading…
Reference in New Issue
Block a user