mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Hack: just track the intermediate depth externally
This commit is contained in:
@@ -1651,7 +1651,7 @@ static bool execIndex(Toy_Interpreter* interpreter, bool assignIntermediate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!TOY_IS_ARRAY(compound) && !TOY_IS_DICTIONARY(compound) && !TOY_IS_STRING(compound)) {
|
if (!TOY_IS_ARRAY(compound) && !TOY_IS_DICTIONARY(compound) && !TOY_IS_STRING(compound)) {
|
||||||
interpreter->errorOutput("Unknown compound found in indexing notation: ");
|
interpreter->errorOutput("Unknown compound found in index notation: ");
|
||||||
Toy_printLiteralCustom(compound, interpreter->errorOutput);
|
Toy_printLiteralCustom(compound, interpreter->errorOutput);
|
||||||
interpreter->errorOutput("\n");
|
interpreter->errorOutput("\n");
|
||||||
|
|
||||||
@@ -1720,7 +1720,7 @@ static bool execIndex(Toy_Interpreter* interpreter, bool assignIntermediate) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool execIndexAssign(Toy_Interpreter* interpreter) {
|
static bool execIndexAssign(Toy_Interpreter* interpreter, int assignDepth) {
|
||||||
//assume -> compound, first, second, third, assign are all on the stack
|
//assume -> compound, first, second, third, assign are all on the stack
|
||||||
|
|
||||||
Toy_Literal assign = TOY_TO_NULL_LITERAL, third = TOY_TO_NULL_LITERAL, second = TOY_TO_NULL_LITERAL, first = TOY_TO_NULL_LITERAL, compound = TOY_TO_NULL_LITERAL, result = TOY_TO_NULL_LITERAL;
|
Toy_Literal assign = TOY_TO_NULL_LITERAL, third = TOY_TO_NULL_LITERAL, second = TOY_TO_NULL_LITERAL, first = TOY_TO_NULL_LITERAL, compound = TOY_TO_NULL_LITERAL, result = TOY_TO_NULL_LITERAL;
|
||||||
@@ -1756,7 +1756,7 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//iterate...
|
//iterate...
|
||||||
while(interpreter->stack.count >= 4) {
|
while(assignDepth-- >= 0) {
|
||||||
Toy_freeLiteral(assign);
|
Toy_freeLiteral(assign);
|
||||||
Toy_freeLiteral(third);
|
Toy_freeLiteral(third);
|
||||||
Toy_freeLiteral(second);
|
Toy_freeLiteral(second);
|
||||||
@@ -1914,6 +1914,9 @@ static void execInterpreter(Toy_Interpreter* interpreter) {
|
|||||||
interpreter->codeStart = interpreter->count;
|
interpreter->codeStart = interpreter->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BUGFIX
|
||||||
|
int intermediateAssignDepth = 0;
|
||||||
|
|
||||||
unsigned char opcode = readByte(interpreter->bytecode, &interpreter->count);
|
unsigned char opcode = readByte(interpreter->bytecode, &interpreter->count);
|
||||||
|
|
||||||
while(opcode != TOY_OP_EOF && opcode != TOY_OP_SECTION_END && !interpreter->panic) {
|
while(opcode != TOY_OP_EOF && opcode != TOY_OP_SECTION_END && !interpreter->panic) {
|
||||||
@@ -2128,12 +2131,14 @@ static void execInterpreter(Toy_Interpreter* interpreter) {
|
|||||||
if (!execIndex(interpreter, true)) {
|
if (!execIndex(interpreter, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
intermediateAssignDepth++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOY_OP_INDEX_ASSIGN:
|
case TOY_OP_INDEX_ASSIGN:
|
||||||
if (!execIndexAssign(interpreter)) {
|
if (!execIndexAssign(interpreter, intermediateAssignDepth)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
intermediateAssignDepth = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOY_OP_POP_STACK:
|
case TOY_OP_POP_STACK:
|
||||||
|
|||||||
Reference in New Issue
Block a user