can specify scope to tree compile

This commit is contained in:
leaf corcoran 2012-01-14 01:38:30 -08:00
parent 16f4c956bf
commit 260b17a878
2 changed files with 8 additions and 6 deletions

View File

@ -450,7 +450,6 @@ Block = (function()
_base_0.__class = _class_0
return _class_0
end)()
local RootBlock
RootBlock = (function()
local _parent_0 = Block
local _base_0 = {
@ -515,8 +514,11 @@ value = function(value)
end
return out
end
tree = function(tree)
local scope = RootBlock()
tree = function(tree, scope)
if scope == nil then
scope = RootBlock()
end
assert(tree, "missing tree")
local runner = coroutine.create(function()
local _list_0 = tree
for _index_0 = 1, #_list_0 do

View File

@ -17,7 +17,7 @@ import concat, insert from table
import pos_to_line, get_closest_line, trim from util
export tree, value, format_error
export Block
export Block, RootBlock
-- buffer for building up a line
class Line
@ -300,8 +300,8 @@ value = (value) ->
out = \render!
out
tree = (tree) ->
scope = RootBlock!
tree = (tree, scope=RootBlock!) ->
assert tree, "missing tree"
runner = coroutine.create ->
scope\stm line for line in *tree