From ec94104a3ce4f88ed1490fd4283ed5a429bf675c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 22 Oct 2013 21:53:35 +0200 Subject: APIDump: Inheritance is tested properly. This fixes #195 's second iteration. --- MCServer/Plugins/APIDump/main.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'MCServer/Plugins/APIDump/main.lua') diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index b608ce256..eb0555d67 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -818,12 +818,10 @@ function WriteHtmlClass(a_ClassAPI, a_AllAPI) local HasConstants = (#a_ClassAPI.Constants > 0); local HasFunctions = (#a_ClassAPI.Functions > 0); local HasVariables = (#a_ClassAPI.Variables > 0); - if (a_ClassAPI.Inherits ~= nil) then - for idx, cls in ipairs(a_ClassAPI.Inherits) do - HasConstants = HasConstants or (#cls.Constants > 0); - HasFunctions = HasFunctions or (#cls.Functions > 0); - HasVariables = HasVariables or (#cls.Variables > 0); - end + for idx, cls in ipairs(InheritanceChain) do + HasConstants = HasConstants or (#cls.Constants > 0); + HasFunctions = HasFunctions or (#cls.Functions > 0); + HasVariables = HasVariables or (#cls.Variables > 0); end -- Write the table of contents: -- cgit v1.2.3 From 34de5210d60d0a026a83ad051ae580c60db0dc4d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 22 Oct 2013 22:07:39 +0200 Subject: APIDump: member variables without a setter are considered constants. This fixes cChatColor constants being reported erroneously as member variables. --- MCServer/Plugins/APIDump/main.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins/APIDump/main.lua') diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua index eb0555d67..2db8b4b1b 100644 --- a/MCServer/Plugins/APIDump/main.lua +++ b/MCServer/Plugins/APIDump/main.lua @@ -158,9 +158,16 @@ function CreateAPITables() end -- Member variables: + local SetField = a_ClassObj[".set"] or {}; if ((a_ClassObj[".get"] ~= nil) and (type(a_ClassObj[".get"]) == "table")) then for k, v in pairs(a_ClassObj[".get"]) do - table.insert(res.Variables, { Name = k }); + if (SetField[k] == nil) then + -- It is a read-only variable, add it as a constant: + table.insert(res.Constants, {Name = k, Value = ""}); + else + -- It is a read-write variable, add it as a variable: + table.insert(res.Variables, { Name = k }); + end end end return res; -- cgit v1.2.3