File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ def function_arg_pointer_hint(function_name:, pos:)
22
22
:ref
23
23
end
24
24
25
+ # @param function_name [String]
26
+ # @return [Symbol] :ref, :raw
27
+ def function_self_pointer_hint ( function_name )
28
+ pointer_hint = data [ "function" ] [ "pointer_hint" ] . dig ( function_name , "self" )
29
+ return pointer_hint . to_sym if pointer_hint
30
+
31
+ :ref
32
+ end
33
+
25
34
# rubocop:disable Style/CaseEquality
26
35
27
36
# Whether generate C function to go
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ function:
68
68
- rb_class_descendants
69
69
70
70
pointer_hint :
71
+ RSTRING_PTR :
72
+ self : raw
71
73
rb_data_object_make :
72
74
4 : sref
73
75
rb_data_typed_object_make :
Original file line number Diff line number Diff line change 21
21
end
22
22
end
23
23
24
+ describe "#function_self_pointer_hint" do
25
+ subject { data . function_self_pointer_hint ( function_name ) }
26
+
27
+ context "found in data.yml" do
28
+ let ( :function_name ) { "RSTRING_PTR" }
29
+
30
+ it { should eq :raw }
31
+ end
32
+
33
+ context "not found in data.yml" do
34
+ let ( :function_name ) { "rb_class2name" }
35
+
36
+ it { should eq :ref }
37
+ end
38
+ end
39
+
24
40
describe "#should_generate_function?" do
25
41
subject { data . should_generate_function? ( function_name ) }
26
42
You can’t perform that action at this time.
0 commit comments