char* Call(ListExecutor* self, SlimList* instruction) { if (SlimList_GetLength(instruction) < 4) return MalformedInstruction(self, instruction); char* instanceName = SlimList_GetStringAt(instruction, 2); char* methodName = SlimList_GetStringAt(instruction, 3); SlimList* args = SlimList_GetTailAt(instruction, 4); char* result = buyString(StatementExecutor_Call(self->executor, instanceName, methodName, args)); SlimList_Destroy(args); return result; }
char* CallAndAssign(ListExecutor* self, SlimList* instruction) { if (SlimList_GetLength(instruction) < 5) return MalformedInstruction(self, instruction); char* symbolName = SlimList_GetStringAt(instruction, 2); char* instanceName = SlimList_GetStringAt(instruction, 3); char* methodName = SlimList_GetStringAt(instruction, 4); SlimList* args = SlimList_GetTailAt(instruction, 5); char* result = CSlim_BuyString(StatementExecutor_Call(self->executor, instanceName, methodName, args)); StatementExecutor_SetSymbol(self->executor, symbolName, result); SlimList_Destroy(args); return result; }