diff --git a/crates/oxc_semantic/examples/simple.rs b/crates/oxc_semantic/examples/simple.rs index eaed27b59..74db99374 100644 --- a/crates/oxc_semantic/examples/simple.rs +++ b/crates/oxc_semantic/examples/simple.rs @@ -26,9 +26,8 @@ fn main() -> std::io::Result<()> { let error_message: String = parser_ret .errors .into_iter() - .map(|error| error.with_source_code(Arc::clone(&source_text)).to_string()) - .join("\n\n"); - + .map(|error| format!("{:?}", error.with_source_code(Arc::clone(&source_text)))) + .join("\n"); println!("Parsing failed:\n\n{error_message}",); return Ok(()); } @@ -36,6 +35,7 @@ fn main() -> std::io::Result<()> { let program = allocator.alloc(parser_ret.program); let semantic = SemanticBuilder::new(&source_text, source_type) + .build_module_record(path.to_path_buf(), program) // Enable additional syntax checks not performed by the parser .with_check_syntax_error(true) // Inform Semantic about comments found while parsing @@ -46,9 +46,8 @@ fn main() -> std::io::Result<()> { let error_message: String = semantic .errors .into_iter() - .map(|error| error.with_source_code(Arc::clone(&source_text)).to_string()) - .join("\n\n"); - + .map(|error| format!("{:?}", error.with_source_code(Arc::clone(&source_text)))) + .join("\n"); println!("Semantic analysis failed:\n\n{error_message}",); }