elua: eo_prefix fix + add method name deduplication to lua generator

This commit is contained in:
Daniel Kolesa 2014-06-23 14:16:12 +01:00
parent 471b4435b4
commit 7ea7542e9e
2 changed files with 17 additions and 3 deletions

View File

@ -122,6 +122,20 @@ local typeconv = function(tps, expr, isin)
return build_calln(tps, expr, false)
end
local dedup_name = function(classn, funcn)
local suffix = classn:match(".+_(.+)" ) or classn
local prefix = funcn:match("([^_]+)_.+") or funcn
if prefix == suffix then
if classn == suffix then
return funcn
else
return classn:match("(.+_).+") .. funcn
end
else
return classn .. "_" .. funcn
end
end
local Node = util.Object:clone {
generate = function(self, s)
end,
@ -170,7 +184,7 @@ local Method = Node:clone {
local allocs = {}
proto.allocs = allocs
proto.full_name = self.parent_node.prefix .. "_" .. proto.name
proto.full_name = dedup_name(self.parent_node.prefix, proto.name)
local dirs = eolian.parameter_dir
@ -266,7 +280,7 @@ local Property = Method:clone {
local allocs = {}
proto.allocs = allocs
proto.full_name = self.parent_node.prefix .. "_" .. proto.name
proto.full_name = dedup_name(self.parent_node.prefix, proto.name)
.. proto.suffix
local dirs = eolian.parameter_dir

View File

@ -400,7 +400,7 @@ M.Class = ffi.metatype("Eolian_Class", {
if v == nil then
local buf = self:namespaces_list_get()
buf[#buf + 1] = self:name_get()
return table.concat(buf, "_")
return table.concat(buf, "_"):lower()
end
return ffi.string(v)
end,