Forgotten cargo fmt + R-A warning cleanup

pull/3/head
itycodes 2 weeks ago
parent e33e43e221
commit b67795cdfb

@ -333,10 +333,10 @@ fn match_number(s: &str) -> Number {
pub fn compile_ast_ssa( pub fn compile_ast_ssa(
ast: Ast, ast: Ast,
vars: &mut Vec<(String, String)>, vars: &mut Vec<(String, String)>,
mut constants: &mut Vec<(String, String)>, constants: &mut Vec<(String, String)>,
mut counter: &mut Box<i32>, counter: &mut Box<i32>,
mut stack: &mut Vec<String>, stack: &mut Vec<String>,
mut out: &mut Vec<(Option<String>, String)>, out: &mut Vec<(Option<String>, String)>,
) { ) {
match ast.clone().list() { match ast.clone().list() {
Some(l) => { Some(l) => {
@ -356,10 +356,16 @@ pub fn compile_ast_ssa(
compile_ast_ssa(val, vars, constants, counter, stack, out); compile_ast_ssa(val, vars, constants, counter, stack, out);
let val_id = stack.pop().unwrap(); let val_id = stack.pop().unwrap();
let ptr_id = stack.pop().unwrap(); let ptr_id = stack.pop().unwrap();
out.push((None, format!("OpStore {} {}", fix_name(&val_id), fix_name(&ptr_id)))); out.push((
None,
format!("OpStore {} {}", fix_name(&val_id), fix_name(&ptr_id)),
));
} }
s => { s => {
panic!("Unknown function: {} with params {:#?} in context:\n{:#?}", s, lst, ast); panic!(
"Unknown function: {} with params {:#?} in context:\n{:#?}",
s, lst, ast
);
} }
} }
} }

@ -68,12 +68,7 @@ fn test_block_ssa() {
let mut module = meta_compile(ast.unwrap()).unwrap(); let mut module = meta_compile(ast.unwrap()).unwrap();
let fun = module.functions.pop().unwrap(); let fun = module.functions.pop().unwrap();
let block = fun.ast.unwrap(); let block = fun.ast.unwrap();
let block = block let block = block.list().unwrap().get(0).unwrap().clone();
.list()
.unwrap()
.get(0)
.unwrap()
.clone();
println!("{:#?}", block); println!("{:#?}", block);
let mut vars = vec![]; let mut vars = vec![];
let mut constants = vec![]; let mut constants = vec![];

@ -7,7 +7,7 @@ use crate::parser::{Ast, Localised, Location};
pub mod backend; pub mod backend;
mod meta_compile; mod meta_compile;
use std::{fmt, ops::Add, ptr}; use std::fmt;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
@ -240,4 +240,3 @@ pub fn meta_compile(ast: Ast) -> Result<Module, CompilerError> {
} }
Ok(module) Ok(module)
} }

@ -291,4 +291,3 @@ fn expected_type() {
panic!() panic!()
}; };
} }

Loading…
Cancel
Save