ResolvedControlThrowable resolve() { return new ResolvedControlThrowable(payload, resumeStack); }
private void saveFrames(ResolvedControlThrowable ct) { Iterator<ResumeInfo> it = ct.frames(); while (it.hasNext()) { callStack = new Cons<>(it.next(), callStack); } }
throw ct.unresolve();
private void continueCurrentCoroutine() { while (callStack != null) { ResumeInfo top = callStack.car; callStack = callStack.cdr; try { if (top.resume(this, error)) { error = null; // top was run } } catch (ResolvedControlThrowable ct) { saveFrames(ct); ct.payload().accept(this); return; } catch (Exception ex) { // unhandled exception: will try finding a handler in the next iteration error = ex; } } assert (callStack == null); coroutineReturn(); }
throw ct.unresolve();
throw ct.unresolve();
/** * Resolves this control throwable by prepending a call frame to it. The resulting * {@link ResolvedControlThrowable} <b>must be thrown</b> in order to continue * unravelling the call stack. * * <p>When resuming this call, the runtime will use {@code resumable} as the function * object used to continue the execution, and supply it with the {@code suspendedState} * object (or an object <i>equivalent</i> to it, see {@link Resumable}) registered * by this method.</p> * * @param resumable the resumable at this level, must not be {@code null} * @param suspendedState the suspended state, may be any value * @return a resolved control throwable, <b>must be thrown</b> * * @throws NullPointerException if {@code resumable} is {@code null} */ public ResolvedControlThrowable resolve(Resumable resumable, Object suspendedState) { return new ResolvedControlThrowable(payload, new Cons<>(new ResumeInfo(resumable, suspendedState), resumeStack)); }
throw ct.unresolve();
throw ct.unresolve();
throw ct.unresolve();
throw ct.unresolve();
private static void _call_comparison_mt(ExecutionContext context, boolean cmpTo, Object handler, Object a, Object b) throws UnresolvedControlThrowable { try { call(context, handler, a, b); } catch (UnresolvedControlThrowable ct) { // suspended in the metamethod call throw ct.resolve(cmpResultResumable(cmpTo), null).unresolve(); } // not suspended: set the result, possibly flipping it ReturnBuffer result = context.getReturnBuffer(); result.setTo(cmpTo == Conversions.booleanValueOf(result.get0())); }
throw ct.unresolve();
throw ct.unresolve();