Class: RKelly::Nodes::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/opal/optimizer/helpers.rb

Instance Method Summary collapse

Instance Method Details

#accept(visitor, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/opal/optimizer/helpers.rb', line 22

def accept (visitor, &block)
  if @destroyed_by
    if RKelly::Visitors::ECMAVisitor === visitor
      "/* destroyed: #{@destroyed_by} */0"
    end
  else
    super
  end
end

#destroy!(by) ⇒ Object



32
33
34
# File 'lib/opal/optimizer/helpers.rb', line 32

def destroy! by
  @destroyed_by = by
end

#value_path?(*patterns) ⇒ Boolean



14
15
16
17
18
19
20
# File 'lib/opal/optimizer/helpers.rb', line 14

def value_path?(*patterns)
  current = self
  patterns.all? do |pattern|
    current = current.value
    pattern === current
  end
end