1
0

analyse_structure is not automatically called, if no info regarding a table could be found.

This commit is contained in:
Jon Michael Aanes 2017-06-24 18:36:01 +02:00
parent 8d88f6195d
commit 4a41111d1e
3 changed files with 6 additions and 6 deletions

View File

@ -257,4 +257,4 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
return { analyze_structure, get_table_info } return analyze_structure

View File

@ -2,7 +2,7 @@
-- Ensure loading library, if it exists, no matter where pretty.lua was loaded from. -- Ensure loading library, if it exists, no matter where pretty.lua was loaded from.
-- Load the library component -- Load the library component
local format_number, format_function, analyze_structure, get_table_info, TABLE_TYPE local format_number, format_function, analyze_structure, TABLE_TYPE
do do
local thispath = ... and select('1', ...):match('.+%.') or '' local thispath = ... and select('1', ...):match('.+%.') or ''
local function import (name, ignore_failure) local function import (name, ignore_failure)
@ -22,7 +22,6 @@ do
-- Load other stuff -- Load other stuff
analyze_structure = import 'analyze_structure' analyze_structure = import 'analyze_structure'
analyze_structure, get_table_info = analyze_structure[1], analyze_structure[2]
TABLE_TYPE = import 'table_type' TABLE_TYPE = import 'table_type'
end end
-- --
@ -308,7 +307,9 @@ local function format_table (t, depth, l)
assert(type(depth) == 'number' and type(l) == 'table') assert(type(depth) == 'number' and type(l) == 'table')
-- Do stuff -- Do stuff
local table_info = l.info[t] or get_table_info(t) if not l.info[t] then analyze_structure(t, l.options.max_depth-depth, l.info) end
local table_info = l.info[t]
assert(table_info)
if l.options.recursion == 'marked' and table_info.marker then if l.options.recursion == 'marked' and table_info.marker then
l[#l+1], l[#l+2], l[#l+3] = '<', table_info.marker, '>' l[#l+1], l[#l+2], l[#l+3] = '<', table_info.marker, '>'
@ -462,7 +463,6 @@ setmetatable(StringBuilder, {
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local DEBUG_OPTIONS = { _all_function_info = true, _table_addr_comment = true } local DEBUG_OPTIONS = { _all_function_info = true, _table_addr_comment = true }
local KNOWN_OPTIONS = { local KNOWN_OPTIONS = {

View File

@ -1,7 +1,7 @@
local SUITE = require('TestSuite').new('analyze_structure') local SUITE = require('TestSuite').new('analyze_structure')
SUITE:setEnviroment { SUITE:setEnviroment {
analyze_structure = require('analyze_structure')[1], analyze_structure = require('analyze_structure'),
TABLE_TYPE = require('table_type') TABLE_TYPE = require('table_type')
} }