mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Changed truthiness
This commit is contained in:
@@ -137,7 +137,7 @@ static bool execAssert(Interpreter* interpreter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IS_TRUTHY(lhs)) {
|
||||
if (IS_NULL(lhs) || !IS_TRUTHY(lhs)) {
|
||||
(*interpreter->assertOutput)(AS_STRING(rhs));
|
||||
return false;
|
||||
}
|
||||
@@ -396,6 +396,11 @@ static bool execValCast(Interpreter* interpreter) {
|
||||
|
||||
Literal result = TO_NULL_LITERAL;
|
||||
|
||||
if (IS_NULL(value)) {
|
||||
printf("Can't cast a null value\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//cast the rhs to the type represented by lhs
|
||||
switch(AS_TYPE(type).typeOf) {
|
||||
case LITERAL_BOOLEAN:
|
||||
@@ -599,6 +604,11 @@ static bool execFalseJump(Interpreter* interpreter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IS_NULL(lit)) {
|
||||
printf("Null detected in comparison\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IS_TRUTHY(lit)) {
|
||||
interpreter->count = target + interpreter->codeStart;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user