This commit is contained in:
collin 2022-11-23 01:28:33 -05:00
parent 7802d7b55b
commit ac4c38d921
4 changed files with 5 additions and 5 deletions

View File

@ -42,7 +42,7 @@ impl<'a> Pass for Unroller<'a> {
// Reconstructs the AST based off any flattening work that is done.
let mut reconstructor = Self::new(st, handler);
let program = reconstructor.reconstruct_program(ast.into_repr());
handler.last_err()?;
handler.last_err().map_err(|e| *e)?;
Ok((Ast::new(program), reconstructor.symbol_table.take()))
}

View File

@ -39,7 +39,7 @@ impl<'a> Pass for CreateSymbolTable<'a> {
fn do_pass((ast, handler): Self::Input) -> Self::Output {
let mut visitor = CreateSymbolTable::new(handler);
visitor.visit_program(ast.as_repr());
handler.last_err()?;
handler.last_err().map_err(|e| *e)?;
Ok(visitor.symbol_table)
}

View File

@ -39,7 +39,7 @@ impl<'a> Pass for TypeChecker<'a> {
fn do_pass((ast, handler, st): Self::Input) -> Self::Output {
let mut visitor = TypeChecker::new(st, handler);
visitor.visit_program(ast.as_repr());
handler.last_err()?;
handler.last_err().map_err(|e| *e)?;
Ok(visitor.symbol_table.take())
}

View File

@ -239,9 +239,9 @@ impl Handler {
/// Gets the last emitted error's exit code if it exists.
/// Then exits the program with it if it did exist.
pub fn last_err(&self) -> Result<(), LeoError> {
pub fn last_err(&self) -> Result<(), Box<LeoError>> {
if let Some(code) = self.inner.borrow().last_emited_err_code() {
Err(LeoError::LastErrorCode(code))
Err(Box::new(LeoError::LastErrorCode(code)))
} else {
Ok(())
}