Fix: Use NOP instead of void in unless macro

The `unless` macro's expansion was updated to use `...` (NOP) instead of
`void`. This change also involved removing the `void` keyword from the
parser, as it is no longer used.
This commit is contained in:
Michael Schimmel
2026-02-19 14:05:32 +01:00
parent 125cf039d5
commit 5e03be17ad
3 changed files with 4 additions and 5 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
;; Benchmark: 100ns
;; Benchmark: 100ns
;; Classic "unless" macro example
;; Demonstrates simple template substitution.
;; Output: 42
(do
(macro unless [c b] `(if ~c void ~b))
(macro unless [c b] `(if ~c ... ~b))
(unless false 42))
+2 -2
View File
@@ -481,7 +481,7 @@ mod tests {
fn test_macro_expansion_unless() {
let source = "
(do
(macro unless [c b] `(if ~c void ~b))
(macro unless [c b] `(if ~c ... ~b))
(unless false 42))
";
let mut parser = Parser::new(source).unwrap();
@@ -496,7 +496,7 @@ mod tests {
if let UntypedKind::Identifier(sym) = &cond.kind {
assert_eq!(sym.name.as_ref(), "false");
} else { panic!("Expected identifier 'false', got {:?}", cond.kind); }
assert!(matches!(then_br.kind, UntypedKind::Constant(Value::Void)));
assert!(matches!(then_br.kind, UntypedKind::Nop));
if let Some(eb) = else_br {
if let UntypedKind::Constant(Value::Int(n)) = &eb.kind {
assert_eq!(*n, 42);
-1
View File
@@ -92,7 +92,6 @@ impl<'a> Parser<'a> {
TokenKind::Identifier(id) => {
match id.as_ref() {
"..." => UntypedKind::Nop,
"void" => UntypedKind::Constant(Value::Void),
_ => UntypedKind::Identifier(id.into()),
}
}