aboutsummaryrefslogtreecommitdiff
path: root/compiler.d
diff options
context:
space:
mode:
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);