Skip to content

Commit cd82f50

Browse files
committed
Small change to internal strscan method for performance.
1 parent 81209ea commit cd82f50

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/truffle/strscan.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,16 @@ def peep(len)
325325
if md
326326
Primitive.matchdata_fixup_positions(md, pos)
327327
@match = md
328-
scan_internal_set_pos_and_str(advance_pos, getstr)
328+
scan_internal_set_pos_and_str(advance_pos, getstr, md)
329329
else
330330
@match = nil
331331
end
332332
end
333333

334-
private def scan_internal_set_pos_and_str(advance_pos, getstr)
335-
return nil unless @match
334+
private def scan_internal_set_pos_and_str(advance_pos, getstr, md)
335+
return nil unless md
336336

337-
fin = Primitive.match_data_byte_end(@match, 0)
337+
fin = Primitive.match_data_byte_end(md, 0)
338338

339339
@prev_pos = @pos
340340
@pos = fin if advance_pos

0 commit comments

Comments
 (0)