Class: Furnace::AVM2::Transform::PropagateConstants
- Inherits:
-
Object
- Object
- Furnace::AVM2::Transform::PropagateConstants
- Includes:
- Visitor
- Defined in:
- lib/furnace-avm2/transform/propagate_constants.rb
Overview
This pass does NOT do proper DFA. It is here only to propagate find-property-strict calls down the AST.
Defined Under Namespace
Classes: Replacer
Instance Method Summary collapse
Instance Method Details
#on_set_local(node) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/furnace-avm2/transform/propagate_constants.rb', line 50 def on_set_local(node) index, value = node.children if value.type == :find_property_strict block = node.parent nodes = block.children[(block.children.index(node) + 1)..-1] replacer = Replacer.new(index, value) if replacer.replace_in(nodes) node.update(:remove) end end end |
#transform(ast, *stuff) ⇒ Object
44 45 46 47 48 |
# File 'lib/furnace-avm2/transform/propagate_constants.rb', line 44 def transform(ast, *stuff) visit ast [ ast, *stuff ] end |