hax/optree-additions.c.inc

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 22 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/Object/Pad/ExtensionBuilder.pm ↑ Summary hax/perl-additions.c.inc »
1 /* vi: set ft=c : */
2  
3 #define newAELEMOP(flags, first, key) S_newAELEMOP(aTHX_ flags, first, key)
4 0 static OP *S_newAELEMOP(pTHX_ U32 flags, OP *first, I32 key)
5 {
6 0 ▶ if(key >= -128 && key < 128 && first->op_type == OP_PADAV) {
Branch: 3 branches
BranchTrueFalseTotal
if(key >= -128 && key < 128 && first->op_type == OP_PADAV) { 0 0 0
if(key >= -128 && key < 128 && first->op_type == OP_PADAV) { 0 0 0
if(key >= -128 && key < 128 && first->op_type == OP_PADAV) { 0 0 0
7 0 OP *o = newOP(OP_AELEMFAST_LEX, flags);
8 0 o->op_private = (I8)key;
9 0 o->op_targ = first->op_targ;
10 0 op_free(first);
11 0 return o;
12 }
13  
14 0 return newBINOP(OP_AELEM, flags, first, newSVOP(OP_CONST, 0, newSViv(key)));
15 }
16  
17 #define HAVE_UNOP_AUX
18  
19 #ifndef HAVE_UNOP_AUX
20 typedef struct UNOP_with_IV {
21 UNOP baseop;
22 IV iv;
23 } UNOP_with_IV;
24  
25 #define newUNOP_with_IV(type, flags, first, iv) S_newUNOP_with_IV(aTHX_ type, flags, first, iv)
26 static OP *S_newUNOP_with_IV(pTHX_ I32 type, I32 flags, OP *first, IV iv)
27 {
28 /* Cargoculted from perl's op.c:Perl_newUNOP()
29 */
30 UNOP_with_IV *op = PerlMemShared_malloc(sizeof(UNOP_with_IV) * 1);
31 NewOp(1101, op, 1, UNOP_with_IV);
32  
33 if(!first)
34 first = newOP(OP_STUB, 0);
35 UNOP *unop = (UNOP *)op;
36 unop->op_type = (OPCODE)type;
37 unop->op_first = first;
38 unop->op_ppaddr = NULL;
39 unop->op_flags = (U8)flags | OPf_KIDS;
40 unop->op_private = (U8)(1 | (flags >> 8));
41  
42 op->iv = iv;
43  
44 return (OP *)op;
45 }
46 #endif
47  
48 #define newMETHOD_REDIR_OP(rclass, methname, flags) S_newMETHOD_REDIR_OP(aTHX_ rclass, methname, flags)
49 0 static OP *S_newMETHOD_REDIR_OP(pTHX_ SV *rclass, SV *methname, I32 flags)
50 {
51 0 OP *op = newMETHOP_named(OP_METHOD_REDIR, flags, methname);
52 #ifdef USE_ITHREADS
53 {
54 /* cargoculted from S_op_relocate_sv() */
55 PADOFFSET ix = pad_alloc(OP_CONST, SVf_READONLY);
56 PAD_SETSV(ix, rclass);
57 cMETHOPx(op)->op_rclass_targ = ix;
58 }
59 #else
60 0 cMETHOPx(op)->op_rclass_sv = rclass;
61 #endif
62  
63 0 return op;
64 }
65  
66 /* If `@_` is called "snail", then elements of it can be called "slugs"; i.e.
67 * snails without their container
68 */
69 #define newSLUGOP(idx) S_newSLUGOP(aTHX_ idx)
70 0 static OP *S_newSLUGOP(pTHX_ int idx)
71 {
72 0 OP *op = newGVOP(OP_AELEMFAST, 0, PL_defgv);
73 0 op->op_private = idx;
74 0 return op;
75 }
76  
77 #ifndef newLISTOPn
78 /* newLISTOPn was added in 5.39.3 */
79 # define newLISTOPn(type, flags, ...) S_newLISTOPn(aTHX_ type, flags, __VA_ARGS__)
80 static OP *S_newLISTOPn(pTHX_ OPCODE type, U32 flags, ...)
81 {
82 va_list args;
83 va_start(args, flags);
84  
85 OP *o = newLISTOP(OP_LIST, 0, NULL, NULL);
86  
87 OP *kid;
88 while((kid = va_arg(args, OP *)))
89 o = op_append_elem(OP_LIST, o, kid);
90  
91 va_end(args);
92  
93 return op_convert_list(type, flags, o);
94 }
95 #endif
« blib/lib/Object/Pad/ExtensionBuilder.pm ↑ Summary hax/perl-additions.c.inc »