slotAsyncWhile() public static method

public static slotAsyncWhile ( IoObject target, IoObject locals, IoObject message, IoObject future ) : IEnumerator
target IoObject
locals IoObject
message IoObject
future IoObject
return IEnumerator
Example #1
0
        public static IoObject slotWhile(IoObject target, IoObject locals, IoObject message)
        {
            IoMessage m = message as IoMessage;

            if (m.async)
            {
                IoState  state           = target.state;
                IoObject future          = IoObject.createObject(state);
                IEnumerator <IoObject> e = IoObject.slotAsyncWhile(target, locals, message, future);
                state.contextList.Add(e);
                return(future);
            }

            IoObject result = target.state.ioNil;

            while (true)
            {
                bool sasync = m.async;
                m.async = false;
                IoObject cond = m.localsValueArgAt(locals, 0);
                if (cond == target.state.ioFalse || cond == target.state.ioNil)
                {
                    break;
                }
                m.async = sasync;
                result  = m.localsValueArgAt(locals, 1);
                if (target.state.handleStatus() != 0)
                {
                    goto done;
                }
            }
done:
            return(result);
        }