diff --git a/src/ast/ast.rs b/src/ast/ast.rs index bff66b1d..8a23d96e 100644 --- a/src/ast/ast.rs +++ b/src/ast/ast.rs @@ -252,7 +252,10 @@ impl AST { #[inline(always)] #[must_use] pub(crate) fn statements(&self) -> &[Stmt] { - self.body.statements() + self.body + .as_deref() + .map(StmtBlock::statements) + .unwrap_or_default() } /// _(internals)_ Get the statements. /// Exported under the `internals` feature only.