Class: Furnace::AVM2::ABC::MultinameKindQName

Inherits:
Record show all
Defined in:
lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb

Instance Attribute Summary

Attributes inherited from Binary::Record

#root

Instance Method Summary collapse

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

#collect_ns(options) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb', line 40

def collect_ns(options)
  return if options[:no_ns].include?(ns)

  names = options[:names]
  if names[name].nil?
    options[:ns].add ns
    names[name] = ns
  elsif names[name] != ns
    options[:no_ns].add ns
  end
end

#context_sizeObject



52
53
54
# File 'lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb', line 52

def context_size
  0
end

#to_astletObject



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

def to_astlet
  node = AST::Node.new(:q, [])

  if ns && ns.name == ""
  elsif ns
    node.children << ns.name
  else
    node.children << "*"
  end

  node.children << name

  node
end

#to_astpat(type = :qname) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb', line 29

def to_astpat(type=:qname)
  case type
  when :qname
    [ :q, (ns.name if ns && !ns.name.empty?), name ].compact
  when :multiname
    [ :m, [ :set, ns.name ], name ]
  else
    raise "unknown astpat type #{type}"
  end
end

#to_sObject



6
7
8
9
10
11
12
# File 'lib/furnace-avm2/abc/metadata/multiname_kind_qname.rb', line 6

def to_s
  if ns
    "#{ns}::#{name || '*'}"
  else
    name || '*'
  end
end