Class: Furnace::AVM2::ABC::ScriptInfo
Instance Attribute Summary
#root
Instance Method Summary
collapse
#codes_to_ast
#initializer_body
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
10
11
12
13
14
15
16
17
18
|
# File 'lib/furnace-avm2/abc/metadata/script_info.rb', line 10
def collect_ns
options = { ns: Set.new, no_ns: Set.new, names: {} }
options[:ns].add package_name.ns if has_name?
initializer.collect_ns(options) if initializer
traits.each { |trait| trait.collect_ns(options) }
options
end
|
#decompile(options = {}) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/furnace-avm2/abc/metadata/script_info.rb', line 20
def decompile(options={})
Furnace::AVM2::Tokens::PackageToken.new(self,
options.merge(collect_ns).merge(
package_type: :script,
package_name: package_name)
)
end
|
#has_name? ⇒ Boolean
28
29
30
|
# File 'lib/furnace-avm2/abc/metadata/script_info.rb', line 28
def has_name?
non_init_traits.any?
end
|
#non_init_traits ⇒ Object
36
37
38
|
# File 'lib/furnace-avm2/abc/metadata/script_info.rb', line 36
def non_init_traits
traits.reject { |trait| trait.kind == :Class }
end
|
#package_name ⇒ Object
32
33
34
|
# File 'lib/furnace-avm2/abc/metadata/script_info.rb', line 32
def package_name
non_init_traits[0].name if non_init_traits.any?
end
|