Debian Codegraph @

hax/force_list_keeping_pushmark.c.inc

raw
1 /* vi: set ft=c : */
2
3 #include "op_sibling_splice.c.inc"
4
5 /* force_list_keeping_pushmark nulls out the OP_LIST itself but preserves
6 * the OP_PUSHMARK inside it. This is essential or else op_contextualize()
7 * will null out both of them and we lose the mark
8 */
9 /* copypasta from core's op.c */
10 #define force_list_keeping_pushmark(o) S_force_list_keeping_pushmark(aTHX_ o)
11 static OP *S_force_list_keeping_pushmark(pTHX_ OP *o)
12 {
13 if(!o || o->op_type != OP_LIST) {
14 OP *rest = NULL;
15 if(o) {
16 rest = OpSIBLING(o);
17 OpLASTSIB_set(o, NULL);
18 }
19 o = newLISTOP(OP_LIST, 0, o, NULL);
20 if(rest)
21 op_sibling_splice(o, cLISTOPo->op_last, 0, rest);
22 }
23 op_null(o);
24 return op_contextualize(o, G_LIST);
25 }