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:
2026-03-27 21:36:01 +01:00
parent 1736602b0d
commit 3d0ea094b0
2 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -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))
}