Allow chained equals.

This commit is contained in:
2024-04-15 16:31:44 -07:00
parent 3d8e0804bc
commit 763a895285
13 changed files with 114 additions and 99 deletions

View File

@@ -129,14 +129,14 @@ proptest::proptest! {
let basic_result = basic_result.map(|x| x.replace('\n', "\r\n"));
if !matches!(basic_result, Err(EvalError::PrimOp(PrimOpError::MathFailure(_)))) {
//use pretty::DocAllocator;
//let allocator = pretty::Arena::new();
//let result = allocator.text("-------------")
// .append(allocator.line())
// .append(program.pretty(&allocator))
// .append(allocator.line());
//result.render_raw(70, &mut pretty::IoWrite::new(std::io::stdout()))
// .expect("rendering works");
use pretty::DocAllocator;
let allocator = pretty::Arena::new();
let result = allocator.text("-------------")
.append(allocator.line())
.append(program.pretty(&allocator))
.append(allocator.line());
result.render_raw(70, &mut pretty::IoWrite::new(std::io::stdout()))
.expect("rendering works");
let compiled_result = Backend::<ObjectModule>::eval(program);
proptest::prop_assert_eq!(basic_result, compiled_result);

View File

@@ -556,7 +556,6 @@ impl<M: Module> Backend<M> {
let pointer = self.module.target_config().pointer_type();
let pointer_to = builder.ins().symbol_value(pointer, *global_value);
builder.ins().store(MemFlags::new(), value, pointer_to, 0);
Ok((builder.ins().iconst(types::I64, 0), VOID_REPR_TYPE))
}
Some(ReferenceBuilder::Argument(_, _)) => {
@@ -571,9 +570,10 @@ impl<M: Module> Backend<M> {
builder.declare_var(variable, value_type);
builder.def_var(variable, value);
variables.insert(name, ReferenceBuilder::Local(value_type, variable));
Ok((builder.ins().iconst(types::I64, 0), VOID_REPR_TYPE))
}
}
Ok((value, value_type))
}
Expression::Call(_, _, function, args) => {