bare_instructions.rb: use Hash#fetch to read attr

to raise descriptive KeyError instead of NoMethodError in case these
attrs are accidentally removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-09-11 14:10:00 +00:00
Родитель 10ff0a2bbe
Коммит 6e3fe890d5
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -102,11 +102,11 @@ class RubyVM::BareInstructions
end end
def handles_sp? def handles_sp?
/\b(false|0)\b/ !~ @attrs['handles_sp'].expr.expr /\b(false|0)\b/ !~ @attrs.fetch('handles_sp').expr.expr
end end
def always_leaf? def always_leaf?
@attrs['leaf'].expr.expr == 'true;' @attrs.fetch('leaf').expr.expr == 'true;'
end end
def complicated_return_values? def complicated_return_values?