Class: Furnace::AVM2::ABC::InstanceInfo
Constant Summary
collapse
- CLASS_SEALED =
0x01
- CLASS_FINAL =
0x02
- CLASS_INTERFACE =
0x04
- CLASS_PROTECTED_NS =
0x08
Instance Attribute Summary
#root
Instance Method Summary
collapse
#initializer_body
#codes_to_ast
Methods inherited from Record
abc_array_of, flag, pool_array, pool_array_of, pool_ref, subset, xlat_direct, xlat_field, xlat_inverse
#byte_length, codegen, codegen_each, inherited, #inspect, method_missing, register, #to_hash, trace, trace_scope, trace_value
Instance Method Details
#collect_ns ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/furnace-avm2/abc/metadata/instance_info.rb', line 65
def collect_ns
options = {
ns: Set.new([ name.ns ]),
names: { name.name => name.ns },
no_ns: Set.new,
}
super_name.collect_ns(options) if super_name
initializer.collect_ns(options) if initializer
interfaces.each { |iface| iface.collect_ns(options) } traits.each { |trait| trait.collect_ns(options) }
klass.traits.each { |trait| trait.collect_ns(options) }
options
end
|
#decompile(options = {}) ⇒ Object
81
82
83
84
85
86
87
|
# File 'lib/furnace-avm2/abc/metadata/instance_info.rb', line 81
def decompile(options={})
Furnace::AVM2::Tokens::PackageToken.new(self,
options.merge(collect_ns).merge(
package_type: (interface? ? :interface : :class),
package_name: name)
)
end
|
#klass ⇒ Object
28
29
30
|
# File 'lib/furnace-avm2/abc/metadata/instance_info.rb', line 28
def klass
root.klasses[root.instances.index(self)]
end
|
#to_astlet ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/furnace-avm2/abc/metadata/instance_info.rb', line 32
def to_astlet
if interface?
root = AST::Node.new(:interface)
else
root = AST::Node.new(:instance)
end
root.children << name.to_astlet
unless interface?
if super_name
root.children << super_name.to_astlet
else
root.children << nil
end
end
if interfaces.any?
root.children << AST::Node.new(:interfaces, interfaces.map(&:to_astlet))
end
if initializer
root.children << AST::Node.new(:initializer,
[ initializer.to_astlet(initializer_idx, name.to_astlet) ])
end
if traits.any?
root.children << AST::Node.new(:traits, traits.map(&:to_astlet))
end
root.normalize_hierarchy!
end
|