Class: GirFFI::Builders::CallbackReturnValueBuilder
Overview
Implements building post-processing statements for return values of callbacks.
Constant Summary
BaseArgumentBuilder::KEYWORDS
Instance Attribute Summary
#arginfo, #array_arg, #is_closure, #length_arg
Instance Method Summary
collapse
#argument_class_name, #array_length_idx, #callarg, #direction, #initialize, #name, #new_variable, #safe, #specialized_type_tag, #type_info
Instance Method Details
#capture_variable_name ⇒ Object
13
14
15
16
17
|
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 13
def capture_variable_name
if is_relevant?
@capture_variable_name ||= new_variable
end
end
|
#is_relevant? ⇒ Boolean
9
10
11
|
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 9
def is_relevant?
!is_void_return_value? && !arginfo.skip?
end
|
#post_conversion ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 33
def post_conversion
if has_post_conversion?
if type_info.flattened_tag == :object
[ "#{post_converted_name} = #{post_convertor.conversion}.to_ptr" ]
else
[ "#{post_converted_name} = #{post_convertor.conversion}" ]
end
else
[]
end
end
|
#post_converted_name ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 19
def post_converted_name
@post_converted_name ||= if has_post_conversion?
new_variable
else
capture_variable_name
end
end
|
#return_value_name ⇒ Object
27
28
29
30
31
|
# File 'lib/gir_ffi/builders/callback_return_value_builder.rb', line 27
def return_value_name
if is_relevant?
post_converted_name unless array_arg
end
end
|