Skip to content

Commit ce66c57

Browse files
committed
S_parse_ident: Collapse two branches into one
These branches differ only 1) in part of the conditions that indicate to take them, so combine those conditions together, 2) the number of bytes to advance, which is easily determinable Otherwise they are identical, so it is easier to understand if they are made common
1 parent 81f75d0 commit ce66c57

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

toke.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10620,32 +10620,24 @@ S_parse_ident(pTHX_ const char *s, const char * const s_end,
1062010620
} while (isWORDCHAR_A(*s));
1062110621
}
1062210622
else if ( allow_package
10623-
&& *s == '\''
10624-
&& FEATURE_APOS_AS_NAME_SEP_IS_ENABLED
10625-
&& isIDFIRST_lazy_if_safe(s + 1, s_end, is_utf8))
10626-
{ /* Convert the apostrophe to "::" */
10627-
if (*d >= e - 2) {
10628-
goto too_long;
10629-
}
10630-
10631-
*(*d)++ = ':';
10632-
*(*d)++ = ':';
10633-
s++;
10634-
}
10635-
else if (allow_package && *s == ':' && s[1] == ':'
10636-
/* Disallow things like Foo::$bar. For the curious, this is
10637-
* the code path that triggers the "Bad name after" warning
10638-
* when looking for barewords.
10639-
*/
10640-
&& !(check_dollar && s[2] == '$'))
10623+
&& ( ( *s == '\''
10624+
&& FEATURE_APOS_AS_NAME_SEP_IS_ENABLED
10625+
&& isIDFIRST_lazy_if_safe(s+1, s_end, is_utf8))
10626+
/* Below we convert the apostrophe to "::" */
10627+
|| ( *s == ':' && s[1] == ':'
10628+
/* Disallow things like Foo::$bar. For the
10629+
* curious, this is the code path that triggers
10630+
* the "Bad name after" warning when looking for
10631+
* barewords. */
10632+
&& !(check_dollar && s[2] == '$'))))
1064110633
{
1064210634
if (*d >= e - 2) {
1064310635
goto too_long;
1064410636
}
1064510637

1064610638
*(*d)++ = ':';
1064710639
*(*d)++ = ':';
10648-
s += 2;
10640+
s += (*s == ':') ? 2 : 1;
1064910641
}
1065010642
else /* None of the above means have come to the end of any
1065110643
identifier*/

0 commit comments

Comments
 (0)