| 1 | /* Before perl 5.22 under -DDEBUGGING, various new*OP() functions throw assert | ||
| 2 | * failures on OP_CUSTOM. | ||
| 3 | * https://rt.cpan.org/Ticket/Display.html?id=128562 | ||
| 4 | */ | ||
| 5 | |||
| 6 | #define newUNOP_CUSTOM(func, flags, first) S_newUNOP_CUSTOM(aTHX_ func, flags, first) | ||
| 7 | 59 | static OP *S_newUNOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first) | |
| 8 | { | ||
| 9 | UNOP *unop; | ||
| 10 | #if HAVE_PERL_VERSION(5,22,0) | ||
| 11 | 59 | unop = (UNOP *)newUNOP(OP_CUSTOM, flags, first); | |
| 12 | #else | ||
| 13 | NewOp(1101, unop, 1, UNOP); | ||
| 14 | unop->op_type = (OPCODE)OP_CUSTOM; | ||
| 15 | unop->op_first = first; | ||
| 16 | unop->op_flags = (U8)(flags | OPf_KIDS); | ||
| 17 | unop->op_private = (U8)(1 | (flags >> 8)); | ||
| 18 | #endif | ||
| 19 | 59 | unop->op_ppaddr = func; | |
| 20 | 59 | return (OP *)unop; | |
| 21 | } | ||
| 22 |