-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
return inside a literal can break JVM stack.
example workaround in List constructor:
// emit the list element
if (element instanceof OperatorNode && ((OperatorNode) element).operator.equals("return")) {
// Special case for return operator: it inserts a `goto` instruction
emitterVisitor.ctx.logDebug("visit(ListNode) return");
emitterVisitor.ctx.mv.visitInsn(Opcodes.POP); // stop construction of RuntimeList instance
emitterVisitor.ctx.mv.visitInsn(Opcodes.POP);
element.accept(emitterVisitor.with(RuntimeContextType.LIST));
return;
} else {
element.accept(emitterVisitor.with(RuntimeContextType.LIST));
}
another possible workaround: use exceptions
Metadata
Metadata
Assignees
Labels
No labels