summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-24 11:36:06 +0100
committerNicholas Clark <nick@ccl4.org>2010-05-21 21:24:34 +0100
commit0cc522c3af5e9943da81cc0c962abc67d3df6925 (patch)
tree3cc6af181161ad1da14b673423302ce2e9db0362 /toke.c
parent4fa7c2bfe0a54ceffcc7c56cdc072eaeaf54cad9 (diff)
downloadperl-0cc522c3af5e9943da81cc0c962abc67d3df6925.tar.gz
Remove the tokeniser hack that prevents compile-time vivification of %stash::
This was put in to ensure that defined %stash:: continued to return false after the implementation of hashes was changed, such that stashes were always defined. defined %stash:: is deprecated. This reverts the tokeniser changes of adc51b978ed1b2e9d4512c9bfa80386ac917d05a, 76138434928a968a390c791aec92e5f00017d01d, d6069db2e52f58ef65bf59f2fd453604270d2205 and part of 9bde8eb087a2c05d4c8b0394a59d28a09fe5f529, and updates the tests added with those commits to reflect the restored (but as yet unreleased) behaviour. I don't think that this should be merged to blead until after 5.12.0 ships, with the enabled deprecation warnings on defined %hash, as it changes subtle behaviour that all current released stable perls accept without warning.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/toke.c b/toke.c
index eac007e2da..dbac16f2c5 100644
--- a/toke.c
+++ b/toke.c
@@ -8052,28 +8052,10 @@ S_pending_ident(pTHX)
pl_yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpvn(PL_tokenbuf + 1,
tokenbuf_len - 1));
pl_yylval.opval->op_private = OPpCONST_ENTERED;
- gv_fetchpvn_flags(
- PL_tokenbuf + 1, tokenbuf_len - 1,
- /* If the identifier refers to a stash, don't autovivify it.
- * Change 24660 had the side effect of causing symbol table
- * hashes to always be defined, even if they were freshly
- * created and the only reference in the entire program was
- * the single statement with the defined %foo::bar:: test.
- * It appears that all code in the wild doing this actually
- * wants to know whether sub-packages have been loaded, so
- * by avoiding auto-vivifying symbol tables, we ensure that
- * defined %foo::bar:: continues to be false, and the existing
- * tests still give the expected answers, even though what
- * they're actually testing has now changed subtly.
- */
- (*PL_tokenbuf == '%'
- && *(d = PL_tokenbuf + tokenbuf_len - 1) == ':'
- && d[-1] == ':'
- ? 0
- : PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : GV_ADD),
- ((PL_tokenbuf[0] == '$') ? SVt_PV
- : (PL_tokenbuf[0] == '@') ? SVt_PVAV
- : SVt_PVHV));
+ gv_fetchpv(PL_tokenbuf+1, PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE,
+ ((PL_tokenbuf[0] == '$') ? SVt_PV
+ : (PL_tokenbuf[0] == '@') ? SVt_PVAV
+ : SVt_PVHV));
return WORD;
}