| 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 | * Based on: https://metacpan.org/release/PEVANS/Syntax-Keyword-Try-0.31/source/hax/newOP_CUSTOM.c.inc | ||
| 6 | */ | ||
| 7 | |||
| 8 | #define newBINOP_CUSTOM(func, flags, first, last) S_newBINOP_CUSTOM(aTHX_ func, flags, first, last) | ||
| 9 | 0 | static OP *S_newBINOP_CUSTOM(pTHX_ OP *(*func)(pTHX), U32 flags, OP *first, OP *last) | |
| 10 | { | ||
| 11 | BINOP *binop; | ||
| 12 | #if HAVE_PERL_VERSION(5,22,0) | ||
| 13 | 0 | binop = (BINOP *)newBINOP(OP_CUSTOM, flags, first, last); | |
| 14 | #else | ||
| 15 | NewOp(1101, binop, 1, BINOP); | ||
| 16 | binop->op_type = (OPCODE)OP_CUSTOM; | ||
| 17 | binop->op_first = first; | ||
| 18 | first->op_sibling = last; | ||
| 19 | binop->op_last = last; | ||
| 20 | binop->op_flags = (U8)(flags | OPf_KIDS); | ||
| 21 | binop->op_private = (U8)(2 | (flags >> 8)); | ||
| 22 | #endif | ||
| 23 | 0 | binop->op_ppaddr = func; | |
| 24 | 0 | return (OP *)binop; | |
| 25 | } |