Fix: Dump AST ignores parse errors
The `dump_ast` method previously bypassed the `compile` method, which meant it would silently ignore parsing errors. This commit ensures that `dump_ast` now delegates to `compile` and correctly propagates any parsing errors. This aligns the behavior of `dump_ast` with other compilation steps and provides better feedback to the user. Fix: Dump AST ignores parse errors The `dump_ast` method now delegates to `compile(source).into_result()?` to properly handle and report parse errors, ensuring consistency with the compilation process.
This commit is contained in:
@@ -580,9 +580,7 @@ impl Environment {
|
||||
|
||||
pub fn dump_ast(&self, source: &str) -> Result<String, String> {
|
||||
self.preload_dependencies(source, None)?;
|
||||
let mut parser = Parser::new(source);
|
||||
let syntax_ast = parser.parse_expression();
|
||||
let compiled = self.compile_syntax(syntax_ast)?;
|
||||
let compiled = self.compile(source).into_result()?;
|
||||
let linked = self.link(compiled);
|
||||
Ok(Dumper::dump(&linked))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user