improve Block's tostring

This commit is contained in:
leaf corcoran 2012-10-27 18:43:25 -07:00
parent df7ca32a4c
commit 5c409cfc49
2 changed files with 15 additions and 3 deletions

View File

@ -110,7 +110,13 @@ Block = (function()
export_all = false, export_all = false,
export_proper = false, export_proper = false,
__tostring = function(self) __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, end,
bubble = function(self, other) bubble = function(self, other)
if other == nil then if other == nil then

View File

@ -55,7 +55,13 @@ class Block
export_all: false export_all: false
export_proper: 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) => new: (@parent, @header, @footer) =>
@current_line = 1 @current_line = 1
@ -250,7 +256,7 @@ class Block
\append_list [@value v for v in *values], delim \append_list [@value v for v in *values], delim
stm: (node, ...) => stm: (node, ...) =>
return if not node -- slip blank statements return if not node -- skip blank statements
node = @root.transform.statement node node = @root.transform.statement node
fn = line_compile[ntype(node)] fn = line_compile[ntype(node)]
if not fn if not fn