diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 05:27:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 05:27:11 +0000 |
commit | 55af62599ae4ffa581cd00cf2da5a726b4e6fabc (patch) | |
tree | e2675a03d585dd372a84d1d66e7869200add44d0 /tool | |
parent | 52a5f76e8b1ab02ee6e259a7cff9e8c5475744e8 (diff) | |
download | ruby-55af62599ae4ffa581cd00cf2da5a726b4e6fabc.tar.gz |
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
Diffstat (limited to 'tool')
-rw-r--r-- | tool/ruby_vm/models/attribute.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tool/ruby_vm/models/attribute.rb b/tool/ruby_vm/models/attribute.rb index f6d95bd67c..f9e158ac41 100644 --- a/tool/ruby_vm/models/attribute.rb +++ b/tool/ruby_vm/models/attribute.rb @@ -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 |