mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-09 09:38:24 +00:00
arns
This commit is contained in:
parent
64dd61be3a
commit
1dfad6e1b6
|
@ -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)?
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue