Class: Furnace::AVM2::ABC::KlassInfo

Inherits:
Record show all
Includes:
InitializerBody, RecordWithTraits
Defined in:
lib/furnace-avm2/abc/metadata/klass_info.rb

Instance Attribute Summary

Attributes inherited from Binary::Record

#root

Instance Method Summary collapse

Methods included from InitializerBody

#initializer_body

Methods included from RecordWithTraits

#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

Methods inherited from Binary::Record

#byte_length, codegen, codegen_each, inherited, #inspect, method_missing, register, #to_hash, trace, trace_scope, trace_value

Instance Method Details

#instanceObject



10
11
12
# File 'lib/furnace-avm2/abc/metadata/klass_info.rb', line 10

def instance
  root.instances[root.klasses.index(self)]
end

#to_astletObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/furnace-avm2/abc/metadata/klass_info.rb', line 14

def to_astlet
  root = AST::Node.new(:klass)

  if initializer
    root.children << AST::Node.new(:initializer,
      [ initializer.to_astlet(initializer_idx, instance.name.to_astlet) ])
  end

  if traits.any?
    root.children << AST::Node.new(:traits, traits.map(&:to_astlet))
  end

  root.normalize_hierarchy!
end