From aafe90221e9f8e8bf15ebc87814a1bb67e5a4dce Mon Sep 17 00:00:00 2001 From: Ben Winston Date: Tue, 23 May 2023 18:19:18 -0400 Subject: not --- compiler.d | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'compiler.d') 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); -- cgit v1.2.3