Class: MilkTea::TypeVisitor
- Inherits:
-
Object
- Object
- MilkTea::TypeVisitor
show all
- Defined in:
- lib/milk_tea/core/types/visitor.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TypeVisitor.
7
8
9
|
# File 'lib/milk_tea/core/types/visitor.rb', line 7
def initialize
@visited = {}
end
|
Instance Method Details
#visit(type) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/milk_tea/core/types/visitor.rb', line 11
def visit(type)
return if type.nil?
return if @visited[type.object_id]
@visited[type.object_id] = true
dispatch(type)
end
|
#visit_children(type) ⇒ Object
48
49
50
|
# File 'lib/milk_tea/core/types/visitor.rb', line 48
def visit_children(type)
type.children.each { |child| visit(child) }
end
|
#visit_default(type) ⇒ Object
76
|
# File 'lib/milk_tea/core/types/visitor.rb', line 76
def visit_default(type); end
|
#visit_dyn(type) ⇒ Object
68
|
# File 'lib/milk_tea/core/types/visitor.rb', line 68
def visit_dyn(type); visit_children(type); end
|
#visit_event(type) ⇒ Object
71
|
# File 'lib/milk_tea/core/types/visitor.rb', line 71
def visit_event(type); visit_children(type); end
|
#visit_function(type) ⇒ Object
65
|
# File 'lib/milk_tea/core/types/visitor.rb', line 65
def visit_function(type); visit_children(type); end
|
#visit_generic_instance(type) ⇒ Object
53
|
# File 'lib/milk_tea/core/types/visitor.rb', line 53
def visit_generic_instance(type); visit_children(type); end
|
#visit_generic_struct_definition(type) ⇒ Object
56
|
# File 'lib/milk_tea/core/types/visitor.rb', line 56
def visit_generic_struct_definition(type); visit_children(type); end
|
#visit_generic_variant_definition(type) ⇒ Object
57
|
# File 'lib/milk_tea/core/types/visitor.rb', line 57
def visit_generic_variant_definition(type); visit_children(type); end
|
#visit_lifetime_ref(type) ⇒ Object
75
|
# File 'lib/milk_tea/core/types/visitor.rb', line 75
def visit_lifetime_ref(type); end
|
#visit_null(type) ⇒ Object
74
|
# File 'lib/milk_tea/core/types/visitor.rb', line 74
def visit_null(type); end
|
#visit_nullable(type) ⇒ Object
52
|
# File 'lib/milk_tea/core/types/visitor.rb', line 52
def visit_nullable(type); visit_children(type); end
|
#visit_parameter(type) ⇒ Object
66
|
# File 'lib/milk_tea/core/types/visitor.rb', line 66
def visit_parameter(type); visit_children(type); end
|
#visit_proc(type) ⇒ Object
64
|
# File 'lib/milk_tea/core/types/visitor.rb', line 64
def visit_proc(type); visit_children(type); end
|
#visit_simd(type) ⇒ Object
70
|
# File 'lib/milk_tea/core/types/visitor.rb', line 70
def visit_simd(type); visit_children(type); end
|
#visit_soa(type) ⇒ Object
69
|
# File 'lib/milk_tea/core/types/visitor.rb', line 69
def visit_soa(type); visit_children(type); end
|
#visit_span(type) ⇒ Object
54
|
# File 'lib/milk_tea/core/types/visitor.rb', line 54
def visit_span(type); visit_children(type); end
|
#visit_struct(type) ⇒ Object
58
|
# File 'lib/milk_tea/core/types/visitor.rb', line 58
def visit_struct(type); visit_children(type); end
|
#visit_struct_instance(type) ⇒ Object
60
|
# File 'lib/milk_tea/core/types/visitor.rb', line 60
def visit_struct_instance(type); visit_children(type); end
|
#visit_task(type) ⇒ Object
55
|
# File 'lib/milk_tea/core/types/visitor.rb', line 55
def visit_task(type); visit_children(type); end
|
#visit_tuple(type) ⇒ Object
67
|
# File 'lib/milk_tea/core/types/visitor.rb', line 67
def visit_tuple(type); visit_children(type); end
|
#visit_type_var(type) ⇒ Object
73
|
# File 'lib/milk_tea/core/types/visitor.rb', line 73
def visit_type_var(type); end
|
#visit_union(type) ⇒ Object
59
|
# File 'lib/milk_tea/core/types/visitor.rb', line 59
def visit_union(type); visit_children(type); end
|
#visit_variant(type) ⇒ Object
61
|
# File 'lib/milk_tea/core/types/visitor.rb', line 61
def visit_variant(type); visit_children(type); end
|
#visit_variant_arm_payload(type) ⇒ Object
63
|
# File 'lib/milk_tea/core/types/visitor.rb', line 63
def visit_variant_arm_payload(type); visit_children(type); end
|
#visit_variant_instance(type) ⇒ Object
62
|
# File 'lib/milk_tea/core/types/visitor.rb', line 62
def visit_variant_instance(type); visit_children(type); end
|