From d9c48382cab58b1264ac032b2cdd782e9bc2b495 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 26 Dec 2023 23:45:26 +0100 Subject: [PATCH] Turn check into assertion --- .../swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java index 6d726b1db..b276626fb 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteTopLevelContextNode.java @@ -129,7 +129,8 @@ private ContextObject commonNLReturn(final AbstractSqueakObject sender, final Co assert sender == NilObject.SINGLETON; throw returnToTopLevel(targetContext, returnValue); } - if (!targetContext.hasClosure() && !senderContext.canBeReturnedTo()) { + if (!senderContext.canBeReturnedTo()) { + assert !targetContext.hasClosure(); return sendCannotReturn(senderContext, returnValue); } ContextObject context = senderContext; @@ -150,10 +151,11 @@ private ContextObject commonNLReturn(final AbstractSqueakObject sender, final Co @TruffleBoundary private ContextObject commonReturn(final ContextObject startContext, final ContextObject targetContext, final Object returnValue) { /* "make sure we can return to the given context" */ - if (!targetContext.hasClosure() && !targetContext.canBeReturnedTo()) { + if (!targetContext.canBeReturnedTo()) { if (startContext == targetContext) { throw returnToTopLevel(targetContext, returnValue); } + assert !targetContext.hasClosure(); return sendCannotReturn(startContext, returnValue); } /*