aboutsummaryrefslogtreecommitdiff
path: root/compiler.d
diff options
context:
space:
mode:
authorBen Winston2023-05-23 18:19:18 -0400
committerBen Winston2023-05-23 18:19:18 -0400
commitaafe90221e9f8e8bf15ebc87814a1bb67e5a4dce (patch)
tree138d5345f7f1fe5a5c210b6c153ff4b8bb901939 /compiler.d
parent6068db6918e2c2c0e34b88014c9ac6d472674e50 (diff)
not
Diffstat (limited to 'compiler.d')
-rw-r--r--compiler.d9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler.d b/compiler.d
index ee9fcef..1920ae0 100644
--- a/compiler.d
+++ b/compiler.d
@@ -458,6 +458,13 @@ class Compiler {
}
}
+ ValueType compileNot(Form[] args) {
+ ValueType vt = resolve(args[0], ValueType.BOOLEAN);
+ func.chunk.writeOp(OpCode.OP_TYPE_CHECK_BOOLEAN, currentLine);
+ func.chunk.writeOp(OpCode.OP_NOT, currentLine);
+ return vt;
+ }
+
void compileBlock(Form form) {
Block block = cast(Block)form;
beginScope();
@@ -571,6 +578,8 @@ class Compiler {
ValueType vt = compileLess(cons.tail, ValueType.NUMBER);
func.chunk.writeOp(OpCode.OP_NOT, cons.line);
return vt;
+ case "not":
+ return compileNot(cons.tail);
default:
/*
writefln("unsure how to compile %s", sym.name);