From 6e3fe890d5fb3c80fac41df0fa1731c27668415c Mon Sep 17 00:00:00 2001 From: k0kubun Date: Tue, 11 Sep 2018 14:10:00 +0000 Subject: [PATCH] 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 --- tool/ruby_vm/models/bare_instructions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/ruby_vm/models/bare_instructions.rb b/tool/ruby_vm/models/bare_instructions.rb index 740949c752..30a6e0ff88 100755 --- a/tool/ruby_vm/models/bare_instructions.rb +++ b/tool/ruby_vm/models/bare_instructions.rb @@ -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?