This commit is contained in:
Edgar 2023-06-12 12:47:58 +02:00
parent 64dd61be3a
commit 1dfad6e1b6
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387
2 changed files with 8 additions and 8 deletions

View file

@ -131,7 +131,7 @@ impl<'ctx> CodeGen<'ctx> {
info!("functions:\n{:#?}", self.functions);
// implement them.
for (_, function) in &self.functions {
for function in self.functions.values() {
self.compile_function(function)?;
}
@ -251,7 +251,7 @@ impl<'ctx> CodeGen<'ctx> {
..
} => {
let value = self
.compile_expression(&value, variables, scope_info)?
.compile_expression(value, variables, scope_info)?
.expect("should have result");
variables.insert(
@ -265,7 +265,7 @@ impl<'ctx> CodeGen<'ctx> {
}
Statement::Mutate { name, value, .. } => {
let value = self
.compile_expression(&value, variables, scope_info)?
.compile_expression(value, variables, scope_info)?
.expect("should have result");
let var = variables
@ -277,7 +277,7 @@ impl<'ctx> CodeGen<'ctx> {
Statement::Return(ret) => {
if let Some(ret) = ret {
let value = self
.compile_expression(&ret, variables, scope_info)?
.compile_expression(ret, variables, scope_info)?
.expect("should have result");
self.builder.build_return(Some(&value));
} else {
@ -397,7 +397,7 @@ impl<'ctx> CodeGen<'ctx> {
scope_info: &HashMap<String, Vec<TypeExp>>,
) -> Result<Option<BasicValueEnum<'ctx>>> {
Ok(match &*expr.value {
Expression::Variable { name } => Some(self.compile_variable(&name, variables)?),
Expression::Variable { name } => Some(self.compile_variable(name, variables)?),
Expression::Literal(term) => Some(self.compile_literal(term)?),
Expression::Call { function, args } => {
self.compile_call(function, args, variables, scope_info)?

View file

@ -92,7 +92,7 @@ fn type_inference_scope(
} => {
new_vars.insert(name.value.clone());
let exp_type = type_inference_expression(&value, &mut scope_vars, storage, None)?;
let exp_type = type_inference_expression(value, &mut scope_vars, storage, None)?;
if !scope_vars.contains_key(&name.value) {
scope_vars.insert(name.value.clone(), vec![]);
@ -121,7 +121,7 @@ fn type_inference_scope(
})?;
}
let exp_type = type_inference_expression(&value, &mut scope_vars, storage, None)?;
let exp_type = type_inference_expression(value, &mut scope_vars, storage, None)?;
let var = scope_vars.get_mut(&name.value).unwrap().last_mut().unwrap();
if var.is_none() {
@ -142,7 +142,7 @@ fn type_inference_scope(
else_body_scope_type_info,
} => {
type_inference_expression(
&condition,
condition,
&mut scope_vars,
storage,
Some(TypeExp::Boolean),