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 _base_0.__class = _class_0
return _class_0 return _class_0
end)() end)()
local RootBlock
RootBlock = (function() RootBlock = (function()
local _parent_0 = Block local _parent_0 = Block
local _base_0 = { local _base_0 = {
@ -515,8 +514,11 @@ value = function(value)
end end
return out return out
end end
tree = function(tree) tree = function(tree, scope)
local scope = RootBlock() if scope == nil then
scope = RootBlock()
end
assert(tree, "missing tree")
local runner = coroutine.create(function() local runner = coroutine.create(function()
local _list_0 = tree local _list_0 = tree
for _index_0 = 1, #_list_0 do 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 import pos_to_line, get_closest_line, trim from util
export tree, value, format_error export tree, value, format_error
export Block export Block, RootBlock
-- buffer for building up a line -- buffer for building up a line
class Line class Line
@ -300,8 +300,8 @@ value = (value) ->
out = \render! out = \render!
out out
tree = (tree) -> tree = (tree, scope=RootBlock!) ->
scope = RootBlock! assert tree, "missing tree"
runner = coroutine.create -> runner = coroutine.create ->
scope\stm line for line in *tree scope\stm line for line in *tree