Skip to content

Commit be7a3e3

Browse files
committed
Use Primitive.hash_get_or_undefined to avoid double Hash lookup
1 parent 6ef19f6 commit be7a3e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/ruby/truffleruby/core/match_data.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ def deconstruct_keys(array_of_names)
7979

8080
array_of_names.each do |key|
8181
Truffle::Type.rb_check_type(key, Symbol)
82-
break unless hash.key?(key)
83-
ret[key] = hash[key]
82+
value = Primitive.hash_get_or_undefined(hash, key)
83+
break if Primitive.undefined?(value)
84+
ret[key] = value
8485
end
8586

8687
ret

0 commit comments

Comments
 (0)