add pretty print

This commit is contained in:
nora 2022-01-04 23:09:18 +01:00
parent 1a77e710d5
commit 76af14a9f4
11 changed files with 114 additions and 5 deletions

View file

@ -62,7 +62,7 @@ pub fn compile<'ast, 'bc, 'gc>(
ast: &'ast Program,
bytecode_bump: &'bc Bump,
rt: &'gc mut RtAlloc,
) -> Result<Vec<'bc, FnBlock<'bc>>, CompilerError> {
) -> Result<&'bc [FnBlock<'bc>], CompilerError> {
let mut compiler = Compiler {
blocks: Vec::new_in(bytecode_bump),
current_block: 0,
@ -73,7 +73,7 @@ pub fn compile<'ast, 'bc, 'gc>(
compiler.compile(ast)?;
Ok(compiler.blocks)
Ok(compiler.blocks.into_bump_slice())
}
impl<'bc, 'gc> Compiler<'bc, 'gc> {