mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Found a weird bug, reporting it
This commit is contained in:
@@ -3,17 +3,16 @@ DONE: var decl with a type, but no value
|
|||||||
DONE: type casting
|
DONE: type casting
|
||||||
DONE: remove optimization option
|
DONE: remove optimization option
|
||||||
DONE: conditionals
|
DONE: conditionals
|
||||||
|
DONE: if-then-else
|
||||||
|
DONE: chained if-then-else
|
||||||
|
DONE: optional block around a path if it's only one statement
|
||||||
|
DONE: while-then
|
||||||
|
DONE: for-then
|
||||||
|
|
||||||
TODO: string concat with the + operator
|
TODO: string concat with the + operator
|
||||||
TODO: empty string as falsy?
|
|
||||||
TODO: increment & decrement operators
|
TODO: increment & decrement operators
|
||||||
TODO: a = b = c = 1;
|
TODO: a = b = c = 1;
|
||||||
TODO: are compounds shallow or deep copies?
|
TODO: are compounds shallow or deep copies?
|
||||||
TODO: if-then-else
|
|
||||||
TODO: chained if-then-else
|
|
||||||
TODO: optional block around a path if it's only one statement
|
|
||||||
TODO: while-then
|
|
||||||
TODO: for-then
|
|
||||||
TODO: break and continue statements
|
TODO: break and continue statements
|
||||||
TODO: functions, and all of their features
|
TODO: functions, and all of their features
|
||||||
TODO: Assertion-based test scripts
|
TODO: Assertion-based test scripts
|
||||||
|
|||||||
9
scripts/empty.toy
Normal file
9
scripts/empty.toy
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
//BUG: this causes a strange error message
|
||||||
|
if (true) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
;
|
||||||
|
}
|
||||||
@@ -573,7 +573,7 @@ static bool execCompareLessEqual(Interpreter* interpreter, bool invert) {
|
|||||||
static bool execJump(Interpreter* interpreter) {
|
static bool execJump(Interpreter* interpreter) {
|
||||||
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
|
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
|
||||||
|
|
||||||
if (target >= interpreter->length) {
|
if (target + interpreter->codeStart > interpreter->length) {
|
||||||
printf("Jump out of range\n");
|
printf("Jump out of range\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -587,7 +587,7 @@ static bool execJump(Interpreter* interpreter) {
|
|||||||
static bool execFalseJump(Interpreter* interpreter) {
|
static bool execFalseJump(Interpreter* interpreter) {
|
||||||
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
|
int target = (int)readShort(interpreter->bytecode, &interpreter->count);
|
||||||
|
|
||||||
if (target >= interpreter->length) {
|
if (target + interpreter->codeStart > interpreter->length) {
|
||||||
printf("Jump out of range\n");
|
printf("Jump out of range\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,3 @@ assert forCache == 19, "for-loop failed";
|
|||||||
|
|
||||||
|
|
||||||
print "All good";
|
print "All good";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user