Class: Furnace::AVM2::Tokens::SpecifiersToken

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

Instance Method Summary collapse

Instance Method Details

#specifiersObject



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

def specifiers
  list = []
  list << "static" if @options[:static]

  unless @options[:environment] == :interface
    if @origin.name.ns.name == ""
      list << "public"
    elsif @options[:instance]
      if @options[:instance].protected_ns? &&
            # protected_ns is not singleton. Why? Fuck me if I know.
            @origin.name.ns.name == @options[:instance].protected_ns.name
        list << "protected"
      elsif @origin.name.ns != @options[:instance].name.ns
        list << "private"
      end
    end
  end

  list
end

#to_textObject



24
25
26
27
28
29
30
31
32
# File 'lib/furnace-avm2/source/declaration_tokens/specifiers_token.rb', line 24

def to_text
  list = specifiers

  if list.any?
    "#{list.join(" ")} "
  else
    ""
  end
end