Sha256: 1ce4e2897731d5e3fc279a389301ce4aa0d7ebbe5cedcec83ff43b1372dbc385

Contents?: true

Size: 1005 Bytes

Versions: 13

Compression:

Stored size: 1005 Bytes

Contents

# frozen_string_literal: true

require "gir_ffi/builders/base_argument_builder"

module GirFFI
  module Builders
    # Implements building post-processing statements for return values of
    # callbacks.
    class BaseReturnValueBuilder < BaseArgumentBuilder
      def relevant?
        !void_return_value? && !arginfo.skip?
      end

      def capture_variable_name
        @capture_variable_name ||= new_variable if relevant?
      end

      def post_converted_name
        @post_converted_name ||= if has_post_conversion?
                                   new_variable
                                 else
                                   capture_variable_name
                                 end
      end

      def return_value_name
        post_converted_name if has_return_value_name?
      end

      def void_return_value?
        specialized_type_tag == :void && !type_info.pointer?
      end

      def has_return_value_name?
        relevant? && !array_arg
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gir_ffi-0.17.0 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.16.1 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.16.0 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.9 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.8 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.7 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.6 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.5 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.4 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.3 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.2 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.1 lib/gir_ffi/builders/base_return_value_builder.rb
gir_ffi-0.15.0 lib/gir_ffi/builders/base_return_value_builder.rb