-- parent script "Node"
property _name
property _arity
property _code
property _children
----------------------------------------
-- @constructor
----------------------------------------
on new (me, name, arity, code, children)
if voidP(children) then children = []
me._name = name
me._arity = arity
me._code = code
me._children = children
return me
end
----------------------------------------
-- Runs a function node, returns result
----------------------------------------
on call (me, null, arg)
-- evaluate children
c = []
repeat with child in me._children
c.add(call(child, _movie, arg))
end repeat
-- evaluate node
res = VOID
do(me._code)
return res
end
----------------------------------------
-- Prints a node
----------------------------------------
on print (me, indent)
if voidP(indent) then indent = ""
put indent&me._name
repeat with c in me._children
c.print(indent&" ")
end repeat
end
----------------------------------------
-- Returns a deep copy
----------------------------------------
on clone (me)
children = []
repeat with c in me._children
children.add(c.clone())
end repeat
return me.script.new(me._name, me._arity, me._code, children)
end
----------------------------------------
--
----------------------------------------
on getChildren (me)
return me._children
end