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

tool/ruby_vm/models/attribute.rb: void for empty arguments

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-15 05:27:11 +00:00
parent 52a5f76e8b
commit 55af62599a

View file

@ -32,13 +32,23 @@ class RubyVM::Attribute
end
def declaration
argv = @insn.opes.map {|o| o[:decl] }.join(', ')
opes = @insn.opes
if opes.empty?
argv = "void"
else
argv = opes.map {|o| o[:decl] }.join(', ')
end
sprintf '%s %s(%s)', @type, name, argv
end
def definition
argv = @insn.opes.map {|o| "MAYBE_UNUSED(#{o[:decl]})" }.join(",\n ")
argv = "\n #{argv}\n" if @insn.opes.size > 1
opes = @insn.opes
if opes.empty?
argv = "void"
else
argv = opes.map {|o| "MAYBE_UNUSED(#{o[:decl]})" }.join(",\n ")
argv = "\n #{argv}\n" if opes.size > 1
end
sprintf "%s\n%s(%s)", @type, name, argv
end
end