// TODO: don't require pop
if (!expr) context.consumeCurrentValue();
}
public void compileYield(Node node, BodyCompiler context, boolean expr) {
final YieldNode yieldNode = (YieldNode) node;
ArgumentsCallback argsCallback = getArgsCallback(yieldNode.getArgsNode());
// TODO: This filtering is kind of gross...it would be nice to get some parser help here
if (argsCallback == null || argsCallback.getArity() == 0) {
context.getInvocationCompiler().yieldSpecific(argsCallback);
} else if ((argsCallback.getArity() == 1 || argsCallback.getArity() == 2 || argsCallback.getArity() == 3) && yieldNode.getExpandArguments()) {
// send it along as arity-specific, we don't need the array
context.getInvocationCompiler().yieldSpecific(argsCallback);
} else {
CompilerCallback argsCallback2 = null;
if (yieldNode.getArgsNode() != null) {
argsCallback2 = new CompilerCallback() {
public void call(BodyCompiler context) {
compile(yieldNode.getArgsNode(), context,true);
}
};
}
context.getInvocationCompiler().yield(argsCallback2, yieldNode.getExpandArguments());
}
// TODO: don't require pop
if (!expr) context.consumeCurrentValue();
}