mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
show class name when dumping in front of {
This commit is contained in:
parent
29d8ccc53f
commit
b7efcd1310
@ -102,7 +102,11 @@ dump = function(what)
|
||||
lines = _accum_0
|
||||
end
|
||||
seen[what] = false
|
||||
return "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
|
||||
local class_name
|
||||
if what.__class then
|
||||
class_name = "<" .. tostring(what.__class.__name) .. ">"
|
||||
end
|
||||
return tostring(class_name or "") .. "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
|
||||
else
|
||||
return tostring(what) .. "\n"
|
||||
end
|
||||
|
@ -70,7 +70,10 @@ dump = (what) ->
|
||||
|
||||
seen[what] = false
|
||||
|
||||
"{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
|
||||
class_name = if what.__class
|
||||
"<#{what.__class.__name}>"
|
||||
|
||||
"#{class_name or ""}{\n" .. concat(lines) .. (" ")\rep((depth - 1)*4) .. "}\n"
|
||||
else
|
||||
tostring(what).."\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user