Class: Furnace::AVM2::Tokens::ScriptToken
- Inherits:
-
Code::NonterminalToken
- Object
- Code::NonterminalToken
- Furnace::AVM2::Tokens::ScriptToken
- Includes:
- TokenWithTraits
- Defined in:
- lib/furnace-avm2/source/declaration_tokens/script_token.rb
Instance Method Summary collapse
-
#initialize(origin, options = {}) ⇒ ScriptToken
constructor
A new instance of ScriptToken.
Methods included from TokenWithTraits
#transform_trait, #transform_traits
Constructor Details
#initialize(origin, options = {}) ⇒ ScriptToken
Returns a new instance of ScriptToken.
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/script_token.rb', line 5 def initialize(origin, ={}) = .merge(environment: :script) global_code = Furnace::AVM2::Decompiler.new(origin.initializer_body, .merge(global_code: true)).decompile super(origin, [ *transform_traits(origin, .merge(static: false)), (global_code if global_code.children.any?) ], ) if [:debug_funids] && global_code.children.any? @children.unshift \ CommentToken.new(origin, "Function ##{origin.initializer_idx}", ) end end |