Class: GirFFI::Builders::ArgumentBuilder
Overview
Implements building pre- and post-processing statements for arguments.
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
#method_argument_name ⇒ Object
11
12
13
14
15
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 11
def method_argument_name
if has_input_value? && !is_array_length_parameter?
name
end
end
|
#post_conversion ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 49
def post_conversion
if has_post_conversion?
value = output_value
["#{post_converted_name} = #{value}"]
else
[]
end
end
|
#post_converted_name ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 17
def post_converted_name
@post_converted_name ||= if has_post_conversion?
new_variable
else
callarg
end
end
|
#pre_conversion ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 31
def pre_conversion
pr = []
case direction
when :in
pr << fixed_array_size_check if needs_size_check?
pr << array_length_assignment if is_array_length_parameter?
pr << "#{callarg} = #{ingoing_convertor.conversion}"
when :inout
pr << fixed_array_size_check if needs_size_check?
pr << array_length_assignment if is_array_length_parameter?
pr << out_parameter_preparation
pr << "#{callarg}.set_value #{ingoing_convertor.conversion}"
when :out
pr << out_parameter_preparation
end
pr
end
|
#return_value_name ⇒ Object
25
26
27
28
29
|
# File 'lib/gir_ffi/builders/argument_builder.rb', line 25
def return_value_name
if has_output_value?
post_converted_name unless is_array_length_parameter?
end
end
|