Fix error
This commit is contained in:
		
							parent
							
								
									91a6485d5a
								
							
						
					
					
						commit
						9710406747
					
				| @ -40,7 +40,7 @@ impl TopLevelStatement { | ||||
|                 let mut scope = Scope::from(module.create_block()); | ||||
| 
 | ||||
|                 for statement in &block.0 { | ||||
|                     statement.codegen(&mut scope); | ||||
|                     statement.codegen(&mut scope)?; | ||||
|                 } | ||||
| 
 | ||||
|                 let value = if let Some(exp) = &block.1 { | ||||
|  | ||||
| @ -18,6 +18,8 @@ pub enum ReidError { | ||||
|     LexerError(#[from] lexer::Error), | ||||
|     #[error(transparent)] | ||||
|     ParserError(#[from] token_stream::Error), | ||||
|     #[error(transparent)] | ||||
|     CodegenError(#[from] codegen::Error), | ||||
| } | ||||
| 
 | ||||
| pub fn compile(source: &str) -> Result<String, ReidError> { | ||||
| @ -37,7 +39,7 @@ pub fn compile(source: &str) -> Result<String, ReidError> { | ||||
| 
 | ||||
|     let mut module = IRModule::new("testmod"); | ||||
|     for statement in statements { | ||||
|         statement.codegen(&mut module); | ||||
|         statement.codegen(&mut module)?; | ||||
|     } | ||||
|     let text = module.print_to_string().unwrap(); | ||||
|     Ok(text.to_owned()) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user