Skip to content

Commit 5dee73f

Browse files
committed
S_is_existing_identifier: Look for specific types
This commit changes to look for an array if the sigil is '@', and a sub if is '&', instead of any type of the given name
1 parent ead8925 commit 5dee73f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

toke.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4488,7 +4488,14 @@ S_is_existing_identifier(pTHX_ char *s, char *e, bool is_utf8)
44884488
scan_ident(s, tmpbuf, size, FALSE);
44894489

44904490
Size_t len = strlen(tmpbuf);
4491-
if (! gv_fetchpvn_flags(tmpbuf, len, is_utf8 ? SVf_UTF8 : 0, SVt_PV)) {
4491+
if (! gv_fetchpvn_flags(tmpbuf, len,
4492+
(is_utf8) ? SVf_UTF8 : 0,
4493+
(s[0] == '@')
4494+
? SVt_PVAV
4495+
: (s[0] == '&')
4496+
? SVt_PVCV
4497+
: SVt_PV))
4498+
{
44924499
len = 0;
44934500
}
44944501

@@ -4672,8 +4679,8 @@ S_intuit_more(pTHX_ char *s, char *e)
46724679
weight -= seen[un_char] * 10;
46734680

46744681
/* Following one of these characters, we look to see if there is an
4675-
* identifier already found in the program by that name. If so,
4676-
* strongly suspect this isn't a character class */
4682+
* identifier already found in the program by that name and type.
4683+
* If so, strongly suspect this isn't a character class */
46774684
if (isWORDCHAR_lazy_if_safe(s+1, PL_bufend, UTF)) {
46784685
Size_t len = is_existing_identifier(s, PL_bufend, UTF);
46794686

0 commit comments

Comments
 (0)