Class: MilkTea::StoredRefSupportedVisitor

Inherits:
TypeVisitor
  • Object
show all
Includes:
TypePredicates
Defined in:
lib/milk_tea/core/types/visitor.rb

Instance Method Summary collapse

Methods included from TypePredicates

#arity_error_message, #atomic_element_type, #atomic_type?, #call_arity_matches?, #callable_param_ref_supported?, #char_pointer_type?, #char_type?, #collection_loop_binding_type, #collection_loop_ref_element_type?, #collection_loop_type, #const_pointer_to, #const_pointer_type?, #contains_ref_type?, #contains_type_var?, #contextual_int_to_float_compatibility?, #contextual_int_to_float_target?, #dyn_type?, #exact_integer_constant_value, #exactly_representable_float32?, #external_numeric_compatibility?, #external_typed_null_pointer_compatibility?, #flatten_field_types, #float_constant_fits_type?, #foreign_boundary_element_compatible?, #foreign_char_pointer_buffer_boundary_compatible?, #foreign_external_layout_compatible?, #foreign_external_layout_field_compatible?, #foreign_function_type_projection_compatible?, #foreign_identity_projection_cast_compatible?, #foreign_identity_projection_compatible?, #foreign_identity_projection_reinterpret_compatible?, #foreign_opaque_c_name, #foreign_span_boundary_compatible?, #function_type_matches_proc_type?, #generic_integer_type_argument?, #integer_constant_fits_type?, #integer_like_char_source_type?, #integer_to_char_compatibility?, #integer_type_argument?, #lossless_external_integer_compatibility?, #lossless_integer_compatibility?, #method_dispatch_receiver_type, #mutable_pointer_type?, #mutable_to_const_pointer_compatibility?, #native_foreign_layout_compatible?, #null_assignable_to?, #numeric_constant_fits_type?, #opaque_type?, #own_to_raw_pointer_compatibility?, #own_type?, #owned_referent_type, #pointee_type, #pointer_type?, #proc_type?, #quat_vec4_layout_compatible?, #ref_lifetime, #ref_type?, #ref_type_without_lifetime?, #referenced_type, #same_external_opaque_c_name?, #same_external_opaque_handle_pointer_compatibility?, #string_builder_ref_type?, #string_builder_type?, #struct_with_target_type?, #task_root_proc_type?, #task_type?, #validate_generic_type!, #value_fits_integer_type?, #void_pointer_type?

Methods inherited from TypeVisitor

#dispatch, #visit, #visit_default, #visit_dyn, #visit_event, #visit_generic_struct_definition, #visit_generic_variant_definition, #visit_lifetime_ref, #visit_null, #visit_nullable, #visit_parameter, #visit_simd, #visit_soa, #visit_span, #visit_struct, #visit_struct_instance, #visit_task, #visit_tuple, #visit_type_var, #visit_union, #visit_variant, #visit_variant_arm_payload, #visit_variant_instance

Constructor Details

#initialize(allow_lifetimes: []) ⇒ StoredRefSupportedVisitor

Returns a new instance of StoredRefSupportedVisitor.



163
164
165
166
167
# File 'lib/milk_tea/core/types/visitor.rb', line 163

def initialize(allow_lifetimes: [])
  super()
  @supported = true
  @allow_lifetimes = allow_lifetimes
end

Instance Method Details

#result?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/milk_tea/core/types/visitor.rb', line 169

def result?
  @supported
end

#visit_generic_instance(type) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/milk_tea/core/types/visitor.rb', line 173

def visit_generic_instance(type)
  if ref_type?(type)
    lt = ref_lifetime(type)
    if lt && @allow_lifetimes.include?(lt)
      visit_children(type)
      return
    end
    @supported = false
    return
  end
  visit_children(type)
end

#visit_proc(type) ⇒ Object Also known as: visit_function



186
187
188
# File 'lib/milk_tea/core/types/visitor.rb', line 186

def visit_proc(type)
  @supported = false unless callable_param_ref_supported?(type)
end