when using export tag, decide whether function is meant to be a class method from 'self' formal arg, otherwise it becomes static.

This commit is contained in:
Steve Donovan 2013-11-18 14:54:28 +02:00
parent 8081e5b43c
commit feabf5c91a
1 changed files with 8 additions and 0 deletions

View File

@ -176,6 +176,7 @@ function File:export_item (name)
for item in self.items:iter() do for item in self.items:iter() do
local tags = item.tags local tags = item.tags
if tags.name == name then if tags.name == name then
tags.export = true
if tags['local'] then if tags['local'] then
tags['local'] = nil tags['local'] = nil
end end
@ -647,6 +648,13 @@ function Item:finish()
elseif #fargs > 0 then -- consistency check! elseif #fargs > 0 then -- consistency check!
local varargs = fargs[#fargs] == '...' local varargs = fargs[#fargs] == '...'
if varargs then table.remove(fargs) end 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 local k = 0
for _,pname in ipairs(param_names) do for _,pname in ipairs(param_names) do
local _,field = split_iden(pname) local _,field = split_iden(pname)