elua: use the new dedup API in lualian

This commit is contained in:
Daniel Kolesa 2014-06-24 17:23:13 +01:00
parent 8a82e0fdf4
commit d870125231
2 changed files with 9 additions and 16 deletions

View File

@ -122,20 +122,6 @@ 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,
@ -184,7 +170,7 @@ local Method = Node:clone {
local allocs = {}
proto.allocs = allocs
proto.full_name = dedup_name(self.parent_node.prefix, proto.name)
proto.full_name = meth:full_c_name_get(self.parent_node.prefix)
local dirs = eolian.parameter_dir
@ -280,7 +266,7 @@ local Property = Method:clone {
local allocs = {}
proto.allocs = allocs
proto.full_name = dedup_name(self.parent_node.prefix, proto.name)
proto.full_name = prop:full_c_name_get(self.parent_node.prefix)
.. proto.suffix
local dirs = eolian.parameter_dir

View File

@ -71,6 +71,7 @@ ffi.cdef [[
Eolian_Function_Type eolian_function_type_get(Eolian_Function *function_id);
Eolian_Function_Scope eolian_function_scope_get(Eolian_Function *function_id);
const char *eolian_function_name_get(Eolian_Function *function_id);
const char *eolian_function_full_c_name_get(Eolian_Function function_id, const char *prefix);
Eolian_Function *eolian_class_function_find_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
const char *eolian_function_data_get(Eolian_Function *function_id, const char *key);
Eina_Bool eolian_function_is_virtual_pure(Eolian_Function *function_id, Eolian_Function_Type f_type);
@ -190,6 +191,12 @@ M.Function = ffi.metatype("Eolian_Function", {
return ffi.string(v)
end,
full_c_name_get = function(self)
local v = eolian.eolian_function_full_c_name_get(self)
if v == nil then return nil end
return ffi.string(v)
end,
data_get = function(self, key)
local v = eolian.eolian_function_data_get(self, key)
if v == nil then return nil end