Class: Xdrgen::AST::Definitions::Union
Instance Method Summary
collapse
#fully_qualified_name, #namespaces
Methods inherited from Base
#sub_type
Instance Method Details
#nested_definitions ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/xdrgen/ast/definitions/union.rb', line 46
def nested_definitions
arms.
map(&:declaration).
reject{|d| d.is_a?(Declarations::Void)}.
map(&:type).
select{|d| d.is_a?(Concerns::NestedDefinition)}
end
|
#resolved_case(kase) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/xdrgen/ast/definitions/union.rb', line 21
def resolved_case(kase)
if discriminant_type.nil? then
found = namespace.find_enum_value(kase.value_s)
raise "Case error: #{kase} (#{kase.value_s}) constant not found" if found.nil?
else
found = discriminant_type.members.find{|m| m.name == kase.value_s}
raise "Case error: #{kase} is not a member of #{discriminant_type.name}" if found.nil?
end
found
end
|