mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
improve Block's tostring
This commit is contained in:
parent
df7ca32a4c
commit
5c409cfc49
@ -110,7 +110,13 @@ Block = (function()
|
||||
export_all = false,
|
||||
export_proper = false,
|
||||
__tostring = function(self)
|
||||
return "Block<> <- " .. tostring(self.parent)
|
||||
local h
|
||||
if "string" == type(self.header) then
|
||||
h = self.header
|
||||
else
|
||||
h = self.header:render()
|
||||
end
|
||||
return "Block<" .. tostring(h) .. "> <- " .. tostring(self.parent)
|
||||
end,
|
||||
bubble = function(self, other)
|
||||
if other == nil then
|
||||
|
@ -55,7 +55,13 @@ class Block
|
||||
export_all: false
|
||||
export_proper: false
|
||||
|
||||
__tostring: => "Block<> <- " .. tostring @parent
|
||||
__tostring: =>
|
||||
h = if "string" == type @header
|
||||
@header
|
||||
else
|
||||
@header\render!
|
||||
|
||||
"Block<#{h}> <- " .. tostring @parent
|
||||
|
||||
new: (@parent, @header, @footer) =>
|
||||
@current_line = 1
|
||||
@ -250,7 +256,7 @@ class Block
|
||||
\append_list [@value v for v in *values], delim
|
||||
|
||||
stm: (node, ...) =>
|
||||
return if not node -- slip blank statements
|
||||
return if not node -- skip blank statements
|
||||
node = @root.transform.statement node
|
||||
fn = line_compile[ntype(node)]
|
||||
if not fn
|
||||
|
Loading…
Reference in New Issue
Block a user