cleaning up tests

This commit is contained in:
2022-09-06 09:22:50 +01:00
parent b8f20add66
commit 17f1dc8647
10 changed files with 116 additions and 36 deletions

View File

@@ -306,7 +306,7 @@ static Opcode writeCompilerWithJumps(Compiler* compiler, Node* node, void* break
//pass to the child nodes, then embed the binary command (math, etc.)
Opcode override = writeCompilerWithJumps(compiler, node->binary.left, breakAddressesPtr, continueAddressesPtr, jumpOffsets);
//special case for when indexing
//special case for when indexing and assigning
if (override != OP_EOF && node->binary.opcode >= OP_VAR_ASSIGN && node->binary.opcode <= OP_VAR_MODULO_ASSIGN) {
writeCompilerWithJumps(compiler, node->binary.right, breakAddressesPtr, continueAddressesPtr, jumpOffsets);
compiler->bytecode[compiler->count++] = (unsigned char)override + 2; //1 byte WARNING: enum arithmetic
@@ -314,6 +314,11 @@ static Opcode writeCompilerWithJumps(Compiler* compiler, Node* node, void* break
return OP_EOF;
}
//compensate for... yikes
if (override != OP_EOF) {
compiler->bytecode[compiler->count++] = (unsigned char)override; //1 byte
}
//return from the index-binary
Opcode ret = writeCompilerWithJumps(compiler, node->binary.right, breakAddressesPtr, continueAddressesPtr, jumpOffsets);