diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-13 06:49:03 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-13 06:49:03 +0000 |
commit | 010205895f86f073b0b2a20bd4cfbb05f0134888 (patch) | |
tree | c882a2e58a11ea7da9d88e25008bea82fca68ee2 /op.c | |
parent | 629ae16350754a5d73cb2e1548dcefcae5ddeda1 (diff) | |
download | perl-010205895f86f073b0b2a20bd4cfbb05f0134888.tar.gz |
support delete() and exists() on array, tied array, and pseudo-hash
elements or slices
p4raw-id: //depot/perl@4796
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -4921,11 +4921,22 @@ Perl_ck_delete(pTHX_ OP *o) o->op_private = 0; if (o->op_flags & OPf_KIDS) { OP *kid = cUNOPo->op_first; - if (kid->op_type == OP_HSLICE) + switch (kid->op_type) { + case OP_ASLICE: + o->op_flags |= OPf_SPECIAL; + /* FALL THROUGH */ + case OP_HSLICE: o->op_private |= OPpSLICE; - else if (kid->op_type != OP_HELEM) - Perl_croak(aTHX_ "%s argument is not a HASH element or slice", + break; + case OP_AELEM: + o->op_flags |= OPf_SPECIAL; + /* FALL THROUGH */ + case OP_HELEM: + break; + default: + Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element or slice", PL_op_desc[o->op_type]); + } null(kid); } return o; @@ -5011,8 +5022,11 @@ Perl_ck_exists(pTHX_ OP *o) o = ck_fun(o); if (o->op_flags & OPf_KIDS) { OP *kid = cUNOPo->op_first; - if (kid->op_type != OP_HELEM) - Perl_croak(aTHX_ "%s argument is not a HASH element", PL_op_desc[o->op_type]); + if (kid->op_type == OP_AELEM) + o->op_flags |= OPf_SPECIAL; + else if (kid->op_type != OP_HELEM) + Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element", + PL_op_desc[o->op_type]); null(kid); } return o; |