Refactor Binder to use Diagnostics

The Binder and its helper functions have been updated to accept and
propagate a `Diagnostics` struct. This allows for better error reporting
during the binding phase, enabling the compiler to continue processing
even after encountering errors and collect all issues before halting.

The `BoundKind::Error` node and `StaticType::Error` are introduced as
"poison" nodes/types. These nodes indicate that an error occurred during
compilation, preventing further valid processing of that specific AST
fragment but allowing the compiler to continue with other parts of the
code.

The `Parser` has also been updated to return a `Diagnostics` struct,
enabling it to report errors during the initial parsing stage while
still attempting to build a partial AST. This adheres to the same error
recovery strategy.
This commit is contained in:
Michael Schimmel
2026-03-02 23:12:51 +01:00
parent f7cb6655af
commit 5bc69c267b
19 changed files with 2678 additions and 2334 deletions
+1
View File
@@ -658,6 +658,7 @@ impl VM {
"Execution of extension '{}' not implemented yet",
ext.display_name()
)),
BoundKind::Error => Err("Cannot execute a poisoned AST node".to_string()),
}
}