mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Progress
This commit is contained in:
@@ -617,9 +617,13 @@ static bool execNegate(Interpreter* interpreter) {
|
||||
//negate the top literal on the stack (numbers only)
|
||||
Literal lit = popLiteralArray(&interpreter->stack);
|
||||
|
||||
if (IS_IDENTIFIER(lit)) {
|
||||
Literal idn = lit;
|
||||
if (!parseIdentifierToValue(interpreter, &lit)) {
|
||||
return false;
|
||||
}
|
||||
freeLiteral(idn);
|
||||
}
|
||||
|
||||
else if (IS_INTEGER(lit)) {
|
||||
lit = TO_INTEGER_LITERAL(-AS_INTEGER(lit));
|
||||
@@ -648,9 +652,13 @@ static bool execInvert(Interpreter* interpreter) {
|
||||
//negate the top literal on the stack (booleans only)
|
||||
Literal lit = popLiteralArray(&interpreter->stack);
|
||||
|
||||
if (IS_IDENTIFIER(lit)) {
|
||||
Literal idn = lit;
|
||||
if (!parseIdentifierToValue(interpreter, &lit)) {
|
||||
return false;
|
||||
}
|
||||
freeLitreral(idn);
|
||||
}
|
||||
|
||||
if (IS_BOOLEAN(lit)) {
|
||||
lit = TO_BOOLEAN_LITERAL(!AS_BOOLEAN(lit));
|
||||
@@ -959,9 +967,13 @@ static bool execValCast(Interpreter* interpreter) {
|
||||
Literal value = popLiteralArray(&interpreter->stack);
|
||||
Literal type = popLiteralArray(&interpreter->stack);
|
||||
|
||||
if (IS_IDENTIFIER(value)) {
|
||||
Literal idn = value;
|
||||
if (!parseIdentifierToValue(interpreter, &value)) {
|
||||
return false;
|
||||
}
|
||||
freeLiteral(idn);
|
||||
}
|
||||
|
||||
Literal result = TO_NULL_LITERAL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user