@@ -272,6 +272,25 @@ def generate_argument_definition(function_name:, arg:, arg_pos:)
272
272
parts . delete_at ( pointer_index )
273
273
end
274
274
275
+ type , pointer , length = analyze_argument_type ( function_name :, arg_pos :, parts :)
276
+
277
+ ArgumentDefinition . new (
278
+ name : parts [ -1 ] ,
279
+ type :,
280
+ pointer :,
281
+ length :,
282
+ )
283
+ end
284
+
285
+ # @param function_name [String]
286
+ # @param arg_pos [Integer]
287
+ # @param parts [Array<String>]
288
+ #
289
+ # @return [Array<String, Symbol, Integer>]
290
+ # - type [String]
291
+ # - pointer [Symbol]
292
+ # - length [Integer]
293
+ def analyze_argument_type ( function_name :, arg_pos :, parts :)
275
294
pointer = nil
276
295
length = 0
277
296
@@ -287,7 +306,6 @@ def generate_argument_definition(function_name:, arg:, arg_pos:)
287
306
end
288
307
289
308
original_type = Util . sanitize_type ( parts [ 0 ...-1 ] . join ( " " ) )
290
- name = parts [ -1 ]
291
309
292
310
if original_type . match? ( /\* +$/ )
293
311
type = original_type . gsub ( /\* +$/ , "" ) . strip
@@ -305,12 +323,7 @@ def generate_argument_definition(function_name:, arg:, arg_pos:)
305
323
length = ::Regexp . last_match ( 1 ) . length
306
324
end
307
325
308
- ArgumentDefinition . new (
309
- type :,
310
- name :,
311
- pointer :,
312
- length :,
313
- )
326
+ [ type , pointer , length ]
314
327
end
315
328
end
316
329
end
0 commit comments