diff options
author | David Mitchell <davem@iabyn.com> | 2014-06-16 14:34:14 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-07-08 16:40:03 +0100 |
commit | 3253bf854af27f38b67fb3a8dfeee758885f3ae9 (patch) | |
tree | 9aac72f516a0892094fdcfda8f56b9cdbd7e1bbd /embed.h | |
parent | e864b323d8621840aac1fda03b2bf69dba6336ff (diff) | |
download | perl-3253bf854af27f38b67fb3a8dfeee758885f3ae9.tar.gz |
add op_sibling_splice() fn and make core use it
The op_sibling_splice() is a new general-purpose OP manipulation
function designed to edit the children of an op, in an analogous
manner in which the perl splice() function manipulates arrays.
This commit also edits op.c and a few other places to remove most direct
manipulation of op_sibling, op_first and op_last, and replace that with
calls to op_sibling_splice().
This has two advantages. First, by using the one function consistently
throughout, it makes it clearer what a particular piece of of code is
doing, rather than having to decipher lots of of ad-hoc
cLISTOPo->op_first = OP_SIBLING(kid);
style stuff. Second, it will make it easier to later add a facility for
child OPs to find their parent, since the changes now only need to be made
in a few places.
In theory this commit should make no functional change to the code.
Diffstat (limited to 'embed.h')
-rw-r--r-- | embed.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -418,6 +418,7 @@ #define op_refcnt_lock() Perl_op_refcnt_lock(aTHX) #define op_refcnt_unlock() Perl_op_refcnt_unlock(aTHX) #define op_scope(a) Perl_op_scope(aTHX_ a) +#define op_sibling_splice(a,b,c,d) Perl_op_sibling_splice(aTHX_ a,b,c,d) #define pack_cat(a,b,c,d,e,f,g) Perl_pack_cat(aTHX_ a,b,c,d,e,f,g) #define packlist(a,b,c,d,e) Perl_packlist(aTHX_ a,b,c,d,e) #define pad_add_anon(a,b) Perl_pad_add_anon(aTHX_ a,b) |