mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-19 16:54:08 +10:00
More subtle bugfixes
This commit is contained in:
@@ -327,6 +327,11 @@ static Opcode writeCompilerWithJumps(Compiler* compiler, Node* node, void* break
|
||||
return node->binary.opcode;
|
||||
}
|
||||
|
||||
if (ret != OP_EOF && (node->binary.opcode == OP_AND || node->binary.opcode == OP_OR || (node->binary.opcode >= OP_COMPARE_EQUAL && node->binary.opcode <= OP_INVERT))) {
|
||||
compiler->bytecode[compiler->count++] = (unsigned char)ret; //1 byte
|
||||
ret = OP_EOF; //untangle in this case
|
||||
}
|
||||
|
||||
compiler->bytecode[compiler->count++] = (unsigned char)node->binary.opcode; //1 byte
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -69,7 +69,7 @@ void freeLiteral(Literal literal) {
|
||||
|
||||
bool _isTruthy(Literal x) {
|
||||
if (IS_NULL(x)) {
|
||||
fprintf(stderr, ERROR "ERROR: Null is neither true nor false" RESET);
|
||||
fprintf(stderr, ERROR "ERROR: Null is neither true nor false\n" RESET);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ static Opcode unary(Parser* parser, Node** nodeHandle) {
|
||||
|
||||
else if (parser->previous.type == TOKEN_NOT) {
|
||||
//temp handle to potentially negate values
|
||||
parsePrecedence(parser, &tmpNode, PREC_TERNARY); //can be a literal
|
||||
parsePrecedence(parser, &tmpNode, PREC_CALL); //can be a literal
|
||||
|
||||
//check for inverted booleans
|
||||
if (tmpNode->type == NODE_LITERAL && IS_BOOLEAN(tmpNode->atomic.literal)) {
|
||||
|
||||
Reference in New Issue
Block a user