summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-05 12:09:48 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-05 12:18:11 +0200
commit9de654f174a7c7ca88031e2ac4a33add560d0c8c (patch)
tree7763181344f0e6240e96c5a444c8a5b57c986dc8 /op.c
parentf1bef09e9115ebdc1c8818193d6c4cbb8bc050e6 (diff)
parent216e7dec1076aa94d5b8331c187c135e4952955a (diff)
downloadperl-9de654f174a7c7ca88031e2ac4a33add560d0c8c.tar.gz
Merge branch 'blead' into smartmatch
Conflicts: t/op/switch.t
Diffstat (limited to 'op.c')
-rw-r--r--op.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/op.c b/op.c
index fe0ad142ce..f1faf42f07 100644
--- a/op.c
+++ b/op.c
@@ -4355,6 +4355,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
PL_eval_start = 0;
else {
if (!PL_madskills) { /* assignment to $[ is ignored when making a mad dump */
+ deprecate("assignment to $[");
op_free(o);
o = newSVOP(OP_CONST, 0, newSViv(CopARYBASE_get(&PL_compiling)));
o->op_private |= OPpCONST_ARYBASE;
@@ -5594,12 +5595,6 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
cv = (!name || GvCVGEN(gv)) ? NULL : GvCV(gv);
-#ifdef GV_UNIQUE_CHECK
- if (cv && GvUNIQUE(gv) && SvREADONLY(cv)) {
- Perl_croak(aTHX_ "Can't define subroutine %s (GV is unique)", name);
- }
-#endif
-
if (!block || !ps || *ps || attrs
|| (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS)
#ifdef PERL_MAD
@@ -5613,12 +5608,6 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
if (cv) {
const bool exists = CvROOT(cv) || CvXSUB(cv);
-#ifdef GV_UNIQUE_CHECK
- if (exists && GvUNIQUE(gv)) {
- Perl_croak(aTHX_ "Can't redefine unique subroutine %s", name);
- }
-#endif
-
/* if the subroutine doesn't exist and wasn't pre-declared
* with a prototype, assume it will be AUTOLOADed,
* skipping the prototype check
@@ -5956,6 +5945,11 @@ S_process_special_blocks(pTHX_ const char *const fullname, GV *const gv,
Creates a constant sub equivalent to Perl C<sub FOO () { 123 }> which is
eligible for inlining at compile-time.
+Passing NULL for SV creates a constant sub equivalent to C<sub BAR () {}>,
+which won't be called if used as a destructor, but will suppress the overhead
+of a call to C<AUTOLOAD>. (This form, however, isn't eligible for inlining at
+compile time.)
+
=cut
*/
@@ -6156,20 +6150,19 @@ Perl_newFORM(pTHX_ I32 floor, OP *o, OP *block)
? gv_fetchsv(cSVOPo->op_sv, GV_ADD, SVt_PVFM)
: gv_fetchpvs("STDOUT", GV_ADD|GV_NOTQUAL, SVt_PVFM);
-#ifdef GV_UNIQUE_CHECK
- if (GvUNIQUE(gv)) {
- Perl_croak(aTHX_ "Bad symbol for form (GV is unique)");
- }
-#endif
GvMULTI_on(gv);
if ((cv = GvFORM(gv))) {
if (ckWARN(WARN_REDEFINE)) {
const line_t oldline = CopLINE(PL_curcop);
if (PL_parser && PL_parser->copline != NOLINE)
CopLINE_set(PL_curcop, PL_parser->copline);
- Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
- o ? "Format %"SVf" redefined"
- : "Format STDOUT redefined", SVfARG(cSVOPo->op_sv));
+ if (o) {
+ Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
+ "Format %"SVf" redefined", SVfARG(cSVOPo->op_sv));
+ } else {
+ Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
+ "Format STDOUT redefined");
+ }
CopLINE_set(PL_curcop, oldline);
}
SvREFCNT_dec(cv);
@@ -6547,6 +6540,8 @@ Perl_ck_eval(pTHX_ OP *o)
/* establish postfix order */
enter->op_next = (OP*)enter;
+ CHECKOP(OP_ENTERTRY, enter);
+
o = prepend_elem(OP_LINESEQ, (OP*)enter, (OP*)kid);
o->op_type = OP_LEAVETRY;
o->op_ppaddr = PL_ppaddr[OP_LEAVETRY];
@@ -8568,7 +8563,7 @@ Perl_peep(pTHX_ register OP *o)
/* Make the CONST have a shared SV */
svp = cSVOPx_svp(((BINOP*)o)->op_last);
- if ((!SvFAKE(sv = *svp) || !SvREADONLY(sv)) && !IS_PADCONST(sv)) {
+ if (!SvFAKE(sv = *svp) || !SvREADONLY(sv)) {
key = SvPV_const(sv, keylen);
lexname = newSVpvn_share(key,
SvUTF8(sv) ? -(I32)keylen : (I32)keylen,
@@ -8973,6 +8968,7 @@ const_sv_xsub(pTHX_ CV* cv)
{
dVAR;
dXSARGS;
+ SV *const sv = MUTABLE_SV(XSANY.any_ptr);
if (items != 0) {
NOOP;
#if 0
@@ -8980,8 +8976,11 @@ const_sv_xsub(pTHX_ CV* cv)
HvNAME_get(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)));
#endif
}
+ if (!sv) {
+ XSRETURN(0);
+ }
EXTEND(sp, 1);
- ST(0) = MUTABLE_SV(XSANY.any_ptr);
+ ST(0) = sv;
XSRETURN(1);
}