Skip to content

Commit b792c58

Browse files
committed
Remove pattern matching pinning to enable support for <= Ruby 3.0
Pattern matching variable pinning was introduced in Ruby 3.1. We need to remove it from YARP to support earlier rubies.
1 parent 62d771d commit b792c58

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/yarp.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def pretty_print(q)
8989
end
9090

9191
def ==(other)
92-
other in Location[start_offset: ^(start_offset), end_offset: ^(end_offset)]
92+
other.is_a?(Location) &&
93+
other.start_offset == start_offset &&
94+
other.end_offset == end_offset
9395
end
9496

9597
def self.null
@@ -195,7 +197,9 @@ def pretty_print(q)
195197
end
196198

197199
def ==(other)
198-
other in Token[type: ^(type), value: ^(value)]
200+
other.is_a?(Token) &&
201+
other.type == type &&
202+
other.value == value
199203
end
200204
end
201205

0 commit comments

Comments
 (0)