mod(scalarseq(block), OP_LEAVESUBLV));
}
else {
+ /* This makes sub {}; work as expected. */
+ if (block->op_type == OP_STUB) {
+ op_free(block);
+ block = newSTATEOP(0, Nullch, 0);
+ }
CvROOT(cv) = newUNOP(OP_LEAVESUB, 0, scalarseq(block));
}
CvROOT(cv)->op_private |= OPpREFCOUNTED;
o->op_seq = PL_op_seqmax++;
break;
case OP_STUB:
- /* XXX This makes sub {}; work as expected.
- ie {return;} not {return @_;}
- When optimiser is properly split into fixups and
- optimisations, this needs to stay in the fixups. */
- if(!oldop &&
- o->op_next &&
- o->op_next->op_type == OP_LEAVESUB) {
- OP* newop = newSTATEOP(0, Nullch, 0);
- newop->op_next = o->op_next;
- o->op_next = 0;
- op_free(o);
- o = newop;
- ((UNOP*)o->op_next)->op_first = newop;
- CvSTART(PL_compcv) = newop;
- }
if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
o->op_seq = PL_op_seqmax++;
break; /* Scalar stub must produce undef. List stub is noop */