λ Support functions! #5

Open
acw wants to merge 59 commits from awick/functions into develop
4 changed files with 21 additions and 9 deletions
Showing only changes of commit d663af8a46 - Show all commits

View File

@@ -6,5 +6,5 @@ print x;
result = add_x(a);
print x;
print result;
result = add_x_twice(a);
print result;
result2 = add_x_twice(a);
print result2;

View File

@@ -471,7 +471,10 @@ impl<M: Module> Backend<M> {
Some(ReferenceBuilder::Global(_, global_value)) => {
let pointer = self.module.target_config().pointer_type();
let pointer_to = builder.ins().symbol_value(pointer, *global_value);
println!("STORE {}: cranelift_type {} origin type {:?}", name, value, value_type);
println!(
"STORE {}: cranelift_type {} origin type {:?}",
name, value, value_type
);
builder.ins().store(MemFlags::new(), value, pointer_to, 0);
Ok((builder.ins().iconst(types::I64, 0), ConstantType::Void))
}
@@ -597,7 +600,10 @@ impl<M: Module> Backend<M> {
let pointer_to = self.module.target_config().pointer_type();
let pointer_value = builder.ins().symbol_value(pointer_to, *gv);
let cranelift_type = ir::Type::from(*ty);
println!("READ {}: cranelift_type {} origin type {:?}", name, cranelift_type, ty);
println!(
"READ {}: cranelift_type {} origin type {:?}",
name, cranelift_type, ty
);
let value =
builder
.ins()

View File

@@ -89,7 +89,9 @@ fn finalize_expression(
Expression::Block(loc, finalize_type(ty, resolutions), final_exprs)
}
Expression::Print(loc, var) => Expression::Print(loc, finalize_val_or_ref(var, resolutions)),
Expression::Print(loc, var) => {
Expression::Print(loc, finalize_val_or_ref(var, resolutions))
}
Expression::Call(loc, ty, fun, args) => Expression::Call(
loc,

View File

@@ -548,7 +548,11 @@ pub fn solve_constraints(
println!("changed something because 13");
}
Constraint::Equivalent(_, TypeOrVar::Variable(_, name1), TypeOrVar::Variable(_, name2)) if name1 == name2 => {
Constraint::Equivalent(
_,
TypeOrVar::Variable(_, name1),
TypeOrVar::Variable(_, name2),
) if name1 == name2 => {
changed_something = true;
}