1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
parent 10ff0a2bbe
commit 6e3fe890d5

View file

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