summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/models/bare_instructions.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-12 08:38:11 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-12 08:38:11 +0000
commit8a72c77c7920d129818b7b83bb4fa669cd7e3f7d (patch)
treee88e17811fdb1059cc3a63199c297582780c8497 /tool/ruby_vm/models/bare_instructions.rb
parent069e9ff52cbb01fe2c5821a9b6a8077ab59c26c7 (diff)
tool/ruby_vm support for pre-2.1 BASERUBY
as requested by devs, support for BASERUBY prior to 2.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/ruby_vm/models/bare_instructions.rb')
-rw-r--r--tool/ruby_vm/models/bare_instructions.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/tool/ruby_vm/models/bare_instructions.rb b/tool/ruby_vm/models/bare_instructions.rb
index c3a96b8f08..a9cb4db953 100644
--- a/tool/ruby_vm/models/bare_instructions.rb
+++ b/tool/ruby_vm/models/bare_instructions.rb
@@ -18,16 +18,16 @@ require_relative 'attribute'
class RubyVM::BareInstructions
attr_reader :template, :name, :opes, :pops, :rets, :decls, :expr
- def initialize template:, name:, location:, signature:, attributes:, expr:
- @template = template
- @name = name
- @loc = location
- @sig = signature
- @expr = RubyVM::CExpr.new expr
+ def initialize opts = {}
+ @template = opts[:template]
+ @name = opts[:name]
+ @loc = opts[:location]
+ @sig = opts[:signature]
+ @expr = RubyVM::CExpr.new opts[:expr]
@opes = typesplit @sig[:ope]
@pops = typesplit @sig[:pop].reject {|i| i == '...' }
@rets = typesplit @sig[:ret].reject {|i| i == '...' }
- @attrs = attributes.map {|i|
+ @attrs = opts[:attributes].map {|i|
RubyVM::Attribute.new insn: self, **i
}.each_with_object({}) {|a, h|
h[a.key] = a
@@ -148,7 +148,10 @@ class RubyVM::BareInstructions
end
end
- @instances = RubyVM::InsnsDef.map {|h| new template: h, **h }
+ @instances = RubyVM::InsnsDef.map {|h|
+ hh = h.merge(:template => h)
+ new hh
+ }
def self.fetch name
@instances.find do |insn|