mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Caught an error in the compiler
This commit is contained in:
@@ -365,7 +365,7 @@ static Toy_Opcode Toy_writeCompilerWithJumps(Toy_Compiler* compiler, Toy_ASTNode
|
||||
//write the else path
|
||||
Toy_Opcode override2 = Toy_writeCompilerWithJumps(compiler, node->pathIf.elsePath, breakAddressesPtr, continueAddressesPtr, jumpOffsets, rootNode);
|
||||
if (override2 != TOY_OP_EOF) {//compensate for indexing & dot notation being screwy
|
||||
compiler->bytecode[compiler->count++] = (unsigned char)override; //1 byte
|
||||
compiler->bytecode[compiler->count++] = (unsigned char)override2; //1 byte
|
||||
}
|
||||
|
||||
//update the jumpToEnd to point here
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//test division prevention
|
||||
{
|
||||
var x = 0;
|
||||
assert (x ? 0 : 1 / x) == 0, "Division by zero prevention failed";
|
||||
assert x ? 0 : 1 / x == 0, "Division by zero prevention failed";
|
||||
}
|
||||
|
||||
//test ambiguous syntax
|
||||
@@ -29,7 +29,7 @@
|
||||
var d = 4;
|
||||
var e = 5;
|
||||
|
||||
assert (a ? b ? c : d : e) == 3, "Ambiguous syntax failed";
|
||||
assert a ? b ? c : d : e == 3, "Ambiguous syntax failed";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user