Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface CompiledForm
* Evaluates a compiled form using the given dynamic context.
* <p>
* <em>Do not call this directly! Go through the evaluator.</em>
*
* @return not null.
*/
Object doEval(Evaluator eval, Store store)
throws FusionException;
Expand Down
14 changes: 10 additions & 4 deletions runtime/src/main/java/dev/ionfusion/fusion/Evaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,15 @@ Object eval(Store store, CompiledForm form)
throw e;
}

if (result == null)
{
return voidValue(this);
}

continue checkingResult;
}
if (result == null)
{
result = voidValue(this);
}

assert result != null;
return result;
}
}
Expand Down Expand Up @@ -566,6 +569,7 @@ Object callNonTail(Procedure proc, Object... args)
throw new FusionInterrupt();
}

// Closures bounce their body form to eliminate a stack frame:
if (result instanceof TailForm)
{
TailForm tail = (TailForm) result;
Expand Down Expand Up @@ -654,6 +658,8 @@ private static final class TailForm
* Wraps an expression for evaluation in tail-position. MUST not be called from a
* procedure. The result MUST be immediately returned to this evaluator, it's not a
* normal value!
*
* @return not null
*/
Object bounceTailForm(Store store, CompiledForm form)
{
Expand Down
Loading