@@ -7,7 +7,7 @@ class ArgumentDefinition
77
88 def_delegators :@definition , :== , :type , :type= , :name , :name= , :pointer , :pointer= , :pointer? , :length , :length=
99
10- include GeneratorHelper
10+ include TypeHelper
1111
1212 # @param definition [RubyHeaderParser::ArgumentDefinition]
1313 # @param header_dir [String]
@@ -35,25 +35,25 @@ def go_name
3535
3636 # @return [String]
3737 def go_function_arg
38- "#{ go_name } #{ ruby_c_type_to_go_type ( type , pointer :, pointer_length : length , pos : :arg ) } "
38+ "#{ go_name } #{ ruby_c_type_to_go_type ( pointer :, pointer_length : length , pos : :arg ) } "
3939 end
4040
4141 # @return [String]
4242 def cast_to_cgo
4343 case pointer
4444 when :array
45- return "toCArray[#{ ruby_c_type_to_go_type ( type ) } , #{ cast_to_cgo_type ( type ) } ](#{ go_name } )"
45+ return "toCArray[#{ ruby_c_type_to_go_type } , #{ cast_to_cgo_type } ](#{ go_name } )"
4646 when :ref_array
47- return "toCArray[*#{ ruby_c_type_to_go_type ( type ) } , *#{ cast_to_cgo_type ( type ) } ](#{ go_name } )"
47+ return "toCArray[*#{ ruby_c_type_to_go_type } , *#{ cast_to_cgo_type } ](#{ go_name } )"
4848 when :sref
4949 return go_name if type == "void" && length == 2
5050
51- return "(#{ "*" * length } #{ cast_to_cgo_type ( type ) } )(unsafe.Pointer(#{ go_name } ))"
51+ return "(#{ "*" * length } #{ cast_to_cgo_type } )(unsafe.Pointer(#{ go_name } ))"
5252 when :in_ref
53- return "(*#{ cast_to_cgo_type ( type ) } )(#{ go_name } )"
53+ return "(*#{ cast_to_cgo_type } )(#{ go_name } )"
5454 end
5555
56- "#{ cast_to_cgo_type ( type ) } (#{ go_name } )"
56+ "#{ cast_to_cgo_type } (#{ go_name } )"
5757 end
5858
5959 # @param char_var_count [Integer]
@@ -75,10 +75,10 @@ def generate_go_arguments(char_var_count:, chars_var_count:)
7575 [ go_name , [ ] , [ ] ]
7676
7777 else
78- c_var_name = "c#{ snake_to_camel ( go_name ) } "
78+ c_var_name = "c#{ GoUtil . snake_to_camel ( go_name ) } "
7979
80- before_call_function_line = "var #{ c_var_name } #{ cast_to_cgo_type ( type ) } "
81- after_call_function_line = "*#{ go_name } = #{ ruby_c_type_to_go_type ( type , pos : :arg ) } (#{ c_var_name } )"
80+ before_call_function_line = "var #{ c_var_name } #{ cast_to_cgo_type } "
81+ after_call_function_line = "*#{ go_name } = #{ ruby_c_type_to_go_type ( pos : :arg ) } (#{ c_var_name } )"
8282
8383 [ "&#{ c_var_name } " , [ before_call_function_line ] , [ after_call_function_line ] ]
8484 end
@@ -105,7 +105,7 @@ def generate_go_arguments(char_var_count:, chars_var_count:)
105105 def generate_go_arguments_for_char_pointer ( char_var_count )
106106 # self is string
107107 if char_var_count >= 2
108- chars_var_name = "char#{ snake_to_camel ( go_name ) } "
108+ chars_var_name = "char#{ GoUtil . snake_to_camel ( go_name ) } "
109109 clean_var_name = "cleanChar#{ go_name } "
110110 else
111111 chars_var_name = "char"
@@ -129,7 +129,7 @@ def generate_go_arguments_for_char_pointer(char_var_count)
129129 # - after_call_function_lines [Array<String>]
130130 def generate_go_arguments_for_str_array ( chars_var_count )
131131 if chars_var_count >= 2
132- chars_var_name = "chars#{ snake_to_camel ( go_name ) } "
132+ chars_var_name = "chars#{ GoUtil . snake_to_camel ( go_name ) } "
133133 clean_var_name = "cleanChars#{ go_name } "
134134 else
135135 chars_var_name = "chars"
0 commit comments