Add prelude and while macro
This commit introduces a new prelude file that defines the `while` macro and registers it during environment bootstrapping. The `again` macro has been updated to accept multiple arguments for its recursive call, and several examples have been adjusted to reflect this change. Additionally, the `MacroRegistry` in the compiler is now cloneable and can be moved out of the `MacroExpander`.
This commit is contained in:
@@ -267,7 +267,7 @@ mod tests {
|
||||
#[should_panic(expected = "'again' is only allowed in tail position to avoid dead code.")]
|
||||
fn test_again_non_tail_panic() {
|
||||
let env = Environment::new();
|
||||
let source = "(do (def f (fn [x] (do (again [(- x 1)]) x))) (f 5))";
|
||||
let source = "(do (def f (fn [x] (do (again (- x 1)) x))) (f 5))";
|
||||
// This will trigger the TCO pass which contains the validation logic
|
||||
let _ = env.run_script(source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user