diff options
| author | ruki <[email protected]> | 2019-07-13 21:55:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-07-13 21:57:43 +0800 |
| commit | d4c9549d251c671502973c208470e0a6cff66bb8 (patch) | |
| tree | c7e272cda27c256ccc34a0de1a53b1af391e96ec | |
| parent | 757cbe8b28ddc852fdbac81f57e18c078d470181 (diff) | |
modify codestyles
| -rw-r--r-- | xmake/core/base/dump.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xmake/core/base/dump.lua b/xmake/core/base/dump.lua index cae90e9a7..34e54508a 100644 --- a/xmake/core/base/dump.lua +++ b/xmake/core/base/dump.lua @@ -25,6 +25,7 @@ local dump = dump or {} local colors = require("base/colors") local table = require("base/table") +-- format string with theme colors function dump._format(fmtkey, fmtdefault, ...) local theme = colors.theme() local fmt = theme and theme:get(fmtkey) or fmtdefault @@ -119,9 +120,9 @@ function dump._print_metatable(value, metatable, inner_indent, printed_set, prin return false end + -- print metamethods local has_record = false local has_index_table = false - -- print metamethods for k, v in pairs(metatable) do if k == "__index" and type(v) == "table" then has_index_table = true @@ -157,8 +158,8 @@ function dump._print_metatable(value, metatable, inner_indent, printed_set, prin return has_record end - local index_table = metatable and rawget(metatable, "__index") -- print index methods + local index_table = metatable and rawget(metatable, "__index") for k, v in pairs(index_table) do -- hide private interfaces if type(k) ~= "string" or not k:startswith("_") then @@ -181,7 +182,6 @@ function dump._print_metatable(value, metatable, inner_indent, printed_set, prin io.write(",") end end - return has_record end @@ -191,9 +191,11 @@ function dump._print_udata(value, first_indent, remain_indent) io.write(first_indent) local metatable = getmetatable(value) local inner_indent = remain_indent .. " " + -- print open brackets io.write(colors.translate("${dim}[")) + -- print metatable local no_value = not dump._print_metatable(value, metatable, inner_indent, { len = 0 }, false) -- print close brackets @@ -220,6 +222,7 @@ function dump._print_table(value, first_indent, remain_indent, printed_set) printed_set = printed_set or { len = 0 } local inner_indent = remain_indent .. " " local first_value = true + -- print open brackets io.write(colors.translate("${dim}{")) |
