From 1dfad6e1b68ac5ec2147096a43bbfb9ba251aa38 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 12 Jun 2023 12:47:58 +0200 Subject: [PATCH] arns --- src/codegen.rs | 10 +++++----- src/type_analysis.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/codegen.rs b/src/codegen.rs index 2272570f4..aeedd0624 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -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>, ) -> Result>> { 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)? diff --git a/src/type_analysis.rs b/src/type_analysis.rs index 324c7882e..cf08e398f 100644 --- a/src/type_analysis.rs +++ b/src/type_analysis.rs @@ -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),