diff options
| author | Ben Winston | 2023-05-23 18:19:18 -0400 |
|---|---|---|
| committer | Ben Winston | 2023-05-23 18:19:18 -0400 |
| commit | aafe90221e9f8e8bf15ebc87814a1bb67e5a4dce (patch) | |
| tree | 138d5345f7f1fe5a5c210b6c153ff4b8bb901939 /compiler.d | |
| parent | 6068db6918e2c2c0e34b88014c9ac6d472674e50 (diff) | |
not
Diffstat (limited to 'compiler.d')
| -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); |
