From b8086c7aec4fa7669b555c78c2381107377b894d Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Tue, 15 Sep 2020 00:53:55 -0400 Subject: [PATCH] + Optimize Range#column_range This avoids the creation of 4 temporary objects --- lib/parser/source/range.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/parser/source/range.rb b/lib/parser/source/range.rb index 1850ae527..cc1d63961 100644 --- a/lib/parser/source/range.rb +++ b/lib/parser/source/range.rb @@ -112,11 +112,11 @@ def last_column # @raise RangeError # def column_range - if self.begin.line != self.end.line + if line != last_line raise RangeError, "#{self.inspect} spans more than one line" end - self.begin.column...self.end.column + column...last_column end ##