File Coverage

hax/force_list_keeping_pushmark.c.inc
Criterion Covered Total %
statement 9 10 90.0
branch 6 10 60.0
condition n/a
subroutine n/a
pod n/a
total 15 20 75.0


line stmt bran cond sub pod time code
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 30           static OP *S_force_list_keeping_pushmark(pTHX_ OP *o)
12             {
13 30 50         if(!o || o->op_type != OP_LIST) {
    100          
14             OP *rest = NULL;
15 27 50         if(o) {
16 27 50         rest = OpSIBLING(o);
17 27           OpLASTSIB_set(o, NULL);
18             }
19 27           o = newLISTOP(OP_LIST, 0, o, NULL);
20 27 50         if(rest)
21 0           op_sibling_splice(o, cLISTOPo->op_last, 0, rest);
22             }
23 30           op_null(o);
24 30           return op_contextualize(o, G_LIST);
25             }