mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
chore(semantic): print errors from examples/simple.rs
This commit is contained in:
parent
4c88997727
commit
7cc2bbd293
1 changed files with 5 additions and 6 deletions
|
|
@ -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}",);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue