From 3547e58f2c57a8363f5eee08af34932ea362f782 Mon Sep 17 00:00:00 2001 From: Eatswap Date: Tue, 13 Dec 2022 15:22:35 +0800 Subject: [PATCH] fix: NOT not correctly executed --- AST.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AST.cpp b/AST.cpp index 7ce3e5b..1f9fd4f 100644 --- a/AST.cpp +++ b/AST.cpp @@ -179,7 +179,7 @@ std::shared_ptr UnaryAST::eval(Context* parent) { auto valS = std::dynamic_pointer_cast(val); switch (this->op) { case NOT: - return std::make_shared(val->isArray() || (valS && !valS->isNil())); + return std::make_shared(!val->isArray() && valS && valS->isNil()); case MAKE_ARRAY: if (val->isArray() || (valS && !valS->isInt())) throw std::runtime_error("Array size must be an integer");