From: Kouhei S. <nu...@co...> - 2017-12-01 00:37:27
|
Kouhei Sutou 2017-12-01 09:34:53 +0900 (Fri, 01 Dec 2017) New Revision: 2eea1f74ae024a77aea776e6a8625d2d96a2de93 https://github.com/ruby-gnome2/ruby-gnome2/commit/2eea1f74ae024a77aea776e6a8625d2d96a2de93 Message: gi: improve Rubyish name generation for treating function as method case Modified files: gobject-introspection/lib/gobject-introspection/loader.rb Modified: gobject-introspection/lib/gobject-introspection/loader.rb (+11 -4) =================================================================== --- gobject-introspection/lib/gobject-introspection/loader.rb 2017-12-01 09:26:09 +0900 (5ff8b5bd1) +++ gobject-introspection/lib/gobject-introspection/loader.rb 2017-12-01 09:34:53 +0900 (4142b894f) @@ -437,6 +437,12 @@ module GObjectIntrospection if name == "initialize" name += "_raw" end + + n_in_args = function_info.n_in_args + if options[:n_in_args_offset] + n_in_args += options[:n_in_args_offset] + end + return_type = function_info.return_type return_type_tag = return_type.tag if return_type_tag == TypeTag::VOID @@ -445,11 +451,12 @@ module GObjectIntrospection return_type_tag = TypeTag::ARRAY end end + case return_type_tag when TypeTag::BOOLEAN case name when "equal" - if function_info.n_in_args == 1 + if n_in_args == 1 "==" else name @@ -457,7 +464,7 @@ module GObjectIntrospection when /\A(?:is|get_is|can_be)_/ "#{$POSTMATCH}?" when /\Aget_/ - if function_info.n_in_args.zero? + if n_in_args.zero? if function_info.n_out_args.zero? "#{$POSTMATCH}?" else @@ -476,7 +483,7 @@ module GObjectIntrospection when TypeTag::GLIST, TypeTag::GSLIST, TypeTag::ARRAY case name when /\A(?:list|get)_/ - if function_info.n_in_args.zero? + if n_in_args.zero? $POSTMATCH else name @@ -487,7 +494,7 @@ module GObjectIntrospection else case name when /\Aget_/ - if function_info.n_in_args.zero? + if n_in_args.zero? $POSTMATCH else name |