class Keisan::AST::Block
Attributes
child[R]
Public Class Methods
new(child)
click to toggle source
# File lib/keisan/ast/block.rb, line 6 def initialize(child) @child = child end
Public Instance Methods
deep_dup()
click to toggle source
# File lib/keisan/ast/block.rb, line 24 def deep_dup dupped = dup dupped.instance_variable_set( :@child, dupped.child.deep_dup ) dupped end
evaluate(context = nil)
click to toggle source
# File lib/keisan/ast/block.rb, line 38 def evaluate(context = nil) local = get_local_context(context) child.evaluate(local) end
replace(variable, replacement)
click to toggle source
# File lib/keisan/ast/block.rb, line 48 def replace(variable, replacement) self end
simplify(context = nil)
click to toggle source
# File lib/keisan/ast/block.rb, line 43 def simplify(context = nil) local = get_local_context(context) child.simplify(local) end
to_s()
click to toggle source
# File lib/keisan/ast/block.rb, line 52 def to_s "{#{child}}" end
traverse(&block)
click to toggle source
Calls superclass method
# File lib/keisan/ast/block.rb, line 20 def traverse(&block) super(&block) || child.traverse(&block) end
unbound_functions(context = nil)
click to toggle source
# File lib/keisan/ast/block.rb, line 15 def unbound_functions(context = nil) local = get_local_context(context) child.unbound_functions(local) end
unbound_variables(context = nil)
click to toggle source
# File lib/keisan/ast/block.rb, line 10 def unbound_variables(context = nil) local = get_local_context(context) child.unbound_variables(local) end
value(context = nil)
click to toggle source
# File lib/keisan/ast/block.rb, line 33 def value(context = nil) local = get_local_context(context) child.evaluated(local).value(local) end
Private Instance Methods
get_local_context(context)
click to toggle source
# File lib/keisan/ast/block.rb, line 58 def get_local_context(context) context ||= Context.new context.spawn_child(transient: false) end