Skip to content

Commit dc2fe1e

Browse files
committed
Change rb_define_variable's 2nd arg to in_ref
1 parent 66f1a80 commit dc2fe1e

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

_tools/ruby_h_to_go/lib/ruby_header_parser/data.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def initialize
1414

1515
# @param function_name [String]
1616
# @param pos [Integer] arg position (1 origin)
17-
# @return [Symbol] :ref, :array, :ref_array, :function, :sref, :str_array
17+
# @return [Symbol] :ref, :array, :ref_array, :function, :sref, :str_array, :in_ref
1818
def function_arg_pointer_hint(function_name:, pos:)
1919
pointer_hint = data["function"]["pointer_hint"].dig(function_name, pos)
2020
return pointer_hint.to_sym if pointer_hint

_tools/ruby_h_to_go/lib/ruby_header_parser/data.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ function:
8686
3: function
8787
rb_define_singleton_method:
8888
3: function
89+
rb_define_variable:
90+
2: in_ref
8991
rb_ensure:
9092
1: function
9193
3: function

_tools/ruby_h_to_go/spec/ruby_header_parser/parser_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,22 @@
185185
its(:typeref) { should eq typedef(type: "int") }
186186
its(:args) { should eq args }
187187
end
188+
189+
context "rb_define_variable" do
190+
subject { definitions.find { |d| d.name == "rb_define_variable" } }
191+
192+
let(:args) do
193+
[
194+
argument(type: "char", name: "name", pointer: :ref),
195+
argument(type: "VALUE", name: "var", pointer: :in_ref),
196+
]
197+
end
198+
199+
its(:name) { should eq "rb_define_variable" }
200+
its(:definition) { should eq "void rb_define_variable(const char *name, VALUE *var)" }
201+
its(:typeref) { should eq typedef(type: "void") }
202+
its(:args) { should eq args }
203+
end
188204
end
189205

190206
describe "#extract_static_inline_function_definitions" do

0 commit comments

Comments
 (0)