File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -298,13 +298,9 @@ module ByteFor
298
298
# To avoid allocating more strings, this modifies the string passed into it
299
299
def self . replace_escaped_characters_in_place ( raw_string )
300
300
raw_string . gsub! ( ESCAPED ) do |matched_str |
301
- if ( res = ESCAPES_REPLACE [ matched_str ] )
302
- res
303
- else
304
- codepoint_1 = ( $1 || $2) . to_i ( 16 )
305
- codepoint_2 = $3
306
-
307
- if codepoint_2
301
+ if ( point_str_1 = $1 || $2)
302
+ codepoint_1 = point_str_1 . to_i ( 16 )
303
+ if ( codepoint_2 = $3)
308
304
codepoint_2 = codepoint_2 . to_i ( 16 )
309
305
if ( codepoint_1 >= 0xD800 && codepoint_1 <= 0xDBFF ) && # leading surrogate
310
306
( codepoint_2 >= 0xDC00 && codepoint_2 <= 0xDFFF ) # trailing surrogate
@@ -318,6 +314,8 @@ def self.replace_escaped_characters_in_place(raw_string)
318
314
else
319
315
[ codepoint_1 ] . pack ( 'U' . freeze )
320
316
end
317
+ else
318
+ ESCAPES_REPLACE [ matched_str ]
321
319
end
322
320
end
323
321
nil
You can’t perform that action at this time.
0 commit comments