mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
can specify scope to tree compile
This commit is contained in:
parent
16f4c956bf
commit
260b17a878
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user