IoCoroutine *IoCoroutine_newWithTry(void *state, IoObject *target, IoObject *locals, IoMessage *message) { IoCoroutine *self = IoCoroutine_new(state); //IoCoroutine_try(self, target, locals, message); IoCoroutine *currentCoro = (IoCoroutine *)IoState_currentCoroutine((IoState *)IOSTATE); IoCoroutine_rawSetRunTarget_(self, target); IoCoroutine_rawSetRunLocals_(self, locals); IoCoroutine_rawSetRunMessage_(self, message); IoCoroutine_rawSetParentCoroutine_(self, currentCoro); IoCoroutine *self = (IoCoroutine *)context; IoObject *result; IoState_setCurrentCoroutine_(IOSTATE, self); //printf("%p-%p start\n", (void *)self, (void *)DATA(self)->cid); result = IoMessage_locals_performOn_(IOSTATE->mainMessage, self, self); IoCoroutine_rawSetResult_(self, result); IoCoroutine_rawReturnToParent(self); // return from newwithTry return self; }
void IoCoroutine_try(IoCoroutine *self, IoObject *target, IoObject *locals, IoMessage *message) { IoCoroutine *currentCoro = (IoCoroutine *)IoState_currentCoroutine((IoState *)IOSTATE); IoCoroutine_rawSetRunTarget_(self, target); IoCoroutine_rawSetRunLocals_(self, locals); IoCoroutine_rawSetRunMessage_(self, message); IoCoroutine_rawSetParentCoroutine_(self, currentCoro); IoCoroutine_rawRun(self); }