Class: Furnace::AVM2::Tokens::SlotToken

Inherits:
Code::SurroundedToken
  • Object
show all
Defined in:
lib/furnace-avm2/source/declaration_tokens/slot_token.rb

Instance Method Summary collapse

Constructor Details

#initialize(origin, options = {}) ⇒ SlotToken

Returns a new instance of SlotToken.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/furnace-avm2/source/declaration_tokens/slot_token.rb', line 3

def initialize(origin, options={})
  super(origin, [
    MetadataToken.new(origin, options),
    SpecifiersToken.new(origin, options),
    SlotNameToken.new(origin, options),
    (TypeToken.new(origin, [
      MultinameToken.new(origin, origin.type, options)
    ], options) if origin.type)
  ], options)

  value = nil

  if options[:property_values]
    *, value = options[:property_values].find { |k,v| k == origin.name.to_astlet }
  end

  if value.nil? && origin.printable_value
    value = ImmediateToken.new(origin, origin.printable_value, options)
  end

  if value
    @children << InitializationToken.new(origin, [ value ], @options)
  end
end

Instance Method Details

#text_afterObject



28
29
30
# File 'lib/furnace-avm2/source/declaration_tokens/slot_token.rb', line 28

def text_after
  ";\n"
end