Add Program node kind

The `Program` node kind is introduced to represent top-level code
blocks, distinguishing them from `Block` nodes which introduce new
scopes. This commit updates various compiler passes to handle the
`Program` node, ensuring correct AST traversal and processing.

The `Program` node is similar to `Block`, but its definitions propagate
to the enclosing scope, unlike `Block` which creates a new, isolated
scope. This distinction is important for how variables and functions are
resolved within the compiled code.
This commit is contained in:
2026-03-31 13:53:51 +02:00
parent 35f5ea0db3
commit 02ea2f0d80
15 changed files with 337 additions and 209 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ fn test_destructuring_scalar_error() {
assert!(result.is_err());
assert_eq!(
result.unwrap_err(),
"Statement 'def' cannot be used as an expression.\nCannot destructure type int as a tuple/vector"
"Cannot destructure type int as a tuple/vector"
);
}