diff options
| -rw-r--r-- | compiler.d | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |
