Testing an obscure bugfix

This commit is contained in:
2023-03-04 15:41:55 +11:00
parent 6e9d42f892
commit 502032e514

View File

@@ -1767,12 +1767,7 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
assign = Toy_popLiteralArray(&interpreter->stack);
}
else {
compound = result;
Toy_freeLiteral(result);
//suppress the extra assign value
Toy_Literal tmp = Toy_popLiteralArray(&interpreter->stack);
Toy_freeLiteral(tmp);
assign = result;
}
third = Toy_popLiteralArray(&interpreter->stack);
@@ -1869,6 +1864,12 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
Toy_freeLiteralArray(&arguments);
}
//BUGFIX: make sure the compound name can be assigned
if (TOY_IS_NULL(compoundIdn)) {
compoundIdn = Toy_popLiteralArray(&interpreter->stack);
freeIdn = true;
}
if (TOY_IS_IDENTIFIER(compoundIdn) && !Toy_setScopeVariable(interpreter->scope, compoundIdn, result, true)) {
interpreter->errorOutput("Incorrect type assigned to compound member ");
Toy_printLiteralCustom(compoundIdn, interpreter->errorOutput);