This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Simplify expression
authorKarl Williamson <khw@cpan.org>
Wed, 28 Dec 2016 03:55:13 +0000 (20:55 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 3 Jan 2017 04:46:42 +0000 (21:46 -0700)
Unless there's a reason its needed, I prefer not to set a variable
within an 'if', as it increases the reader's cognitive load.

toke.c

diff --git a/toke.c b/toke.c
index b6c9a71..72e22ec 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3006,13 +3006,13 @@ S_scan_const(pTHX_ char *start)
                  * Unicode value (\N{...}), or if the range is a subset of
                  * [A-Z] or [a-z], and both ends are literal characters,
                  * like 'A', and not like \x{C1} */
-                if ((convert_unicode
-                     = cBOOL(backslash_N)   /* \N{} forces Unicode, hence
+                convert_unicode =
+                       cBOOL(backslash_N)   /* \N{} forces Unicode, hence
                                                portable range */
                       || (   ! non_portable_endpoint
                           && ((  isLOWER_A(range_min) && isLOWER_A(range_max))
-                             || (isUPPER_A(range_min) && isUPPER_A(range_max))))
-                )) {
+                             || (isUPPER_A(range_min) && isUPPER_A(range_max))));
+                if (convert_unicode) {
 
                     /* Special handling is needed for these portable ranges.
                      * They are defined to all be in Unicode terms, which