Skip to content

Commit

Permalink
Sort result of lexer.parse by pos in ruby<2.7. It's not sorted when t…
Browse files Browse the repository at this point in the history
…he given code includes heredoc.
  • Loading branch information
tompng committed Sep 21, 2022
1 parent 18427ab commit c67a079
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/irb/ruby-lex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def self.ripper_lex_without_warning(code, context: nil)
end
end
else
tokens = lexer.parse.reject { |it| it.pos.first == 0 }
tokens = lexer.parse.sort_by(&:pos).reject { |it| it.pos.first == 0 }
end
end
tokens
Expand Down

0 comments on commit c67a079

Please sign in to comment.