From feabf5c91a0e96190d90a189664881dc02a32b23 Mon Sep 17 00:00:00 2001 From: Steve Donovan Date: Mon, 18 Nov 2013 14:54:28 +0200 Subject: [PATCH] when using export tag, decide whether function is meant to be a class method from 'self' formal arg, otherwise it becomes static. --- ldoc/doc.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 77b8431..7e80070 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -176,6 +176,7 @@ function File:export_item (name) for item in self.items:iter() do local tags = item.tags if tags.name == name then + tags.export = true if tags['local'] then tags['local'] = nil end @@ -647,6 +648,13 @@ function Item:finish() elseif #fargs > 0 then -- consistency check! local varargs = fargs[#fargs] == '...' if varargs then table.remove(fargs) end + if tags.export then + if fargs[1] == 'self' then + table.remove(fargs,1) + else + tags.static = true + end + end local k = 0 for _,pname in ipairs(param_names) do local _,field = split_iden(pname)