fix: NOT not correctly executed
This commit is contained in:
parent
266273963c
commit
3547e58f2c
2
AST.cpp
2
AST.cpp
|
|
@ -179,7 +179,7 @@ std::shared_ptr<Value> UnaryAST::eval(Context* parent) {
|
||||||
auto valS = std::dynamic_pointer_cast<SingleValue>(val);
|
auto valS = std::dynamic_pointer_cast<SingleValue>(val);
|
||||||
switch (this->op) {
|
switch (this->op) {
|
||||||
case NOT:
|
case NOT:
|
||||||
return std::make_shared<SingleValue>(val->isArray() || (valS && !valS->isNil()));
|
return std::make_shared<SingleValue>(!val->isArray() && valS && valS->isNil());
|
||||||
case MAKE_ARRAY:
|
case MAKE_ARRAY:
|
||||||
if (val->isArray() || (valS && !valS->isInt()))
|
if (val->isArray() || (valS && !valS->isInt()))
|
||||||
throw std::runtime_error("Array size must be an integer");
|
throw std::runtime_error("Array size must be an integer");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue