Skip to content

Commit 8432a5e

Browse files
committed
nits: Extract to pointer_length
1 parent aadb704 commit 8432a5e

File tree

1 file changed

+7
-4
lines changed
  • _tools/ruby_h_to_go/lib/ruby_header_parser

1 file changed

+7
-4
lines changed

_tools/ruby_h_to_go/lib/ruby_header_parser/parser.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,15 @@ def analyze_argument_type(function_name:, arg_pos:, parts:)
321321
type = original_type
322322
end
323323

324-
if pointer == :sref
325-
original_type =~ /(\*+)$/
326-
length = ::Regexp.last_match(1).length
327-
end
324+
length = pointer_length(original_type) if pointer == :sref
328325

329326
[type, pointer, length]
330327
end
328+
329+
# @param type [String]
330+
def pointer_length(type)
331+
type =~ /(\*+)$/
332+
::Regexp.last_match(1).length
333+
end
331334
end
332335
end

0 commit comments

Comments
 (0)