From 7d6e2561a4a672e46b7f9d0553a624949b2eb794 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Mon, 12 Mar 2018 14:27:20 +0100 Subject: [PATCH] elua: update eolian name APIs --- src/bindings/luajit/eolian.lua | 149 +-------- src/scripts/elua/apps/docgen/doctree.lua | 400 ++++++++--------------- src/scripts/elua/apps/docgen/stats.lua | 22 +- src/scripts/elua/apps/gendoc.lua | 60 ++-- src/scripts/elua/modules/lualian.lua | 16 +- 5 files changed, 208 insertions(+), 439 deletions(-) diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index 70d66cb5a9..07179190be 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -290,6 +290,8 @@ ffi.cdef [[ int eolian_object_line_get(const Eolian_Object *obj); int eolian_object_column_get(const Eolian_Object *obj); const char *eolian_object_name_get(const Eolian_Object *obj); + const char *eolian_object_short_name_get(const Eolian_Object *obj); + Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj); Eina_Bool eolian_state_directory_add(Eolian_State *state, const char *dir); Eina_Bool eolian_state_system_directory_add(Eolian_State *state); Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state); @@ -339,9 +341,6 @@ ffi.cdef [[ Eina_Iterator *eolian_unit_structs_get(const Eolian_Unit *unit); Eina_Iterator *eolian_unit_enums_get(const Eolian_Unit *unit); - const char *eolian_class_full_name_get(const Eolian_Class *klass); - const char *eolian_class_name_get(const Eolian_Class *klass); - Eina_Iterator *eolian_class_namespaces_get(const Eolian_Class *klass); Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass); const char *eolian_class_legacy_prefix_get(const Eolian_Class *klass); @@ -351,7 +350,6 @@ ffi.cdef [[ Eina_Iterator *eolian_class_functions_get(const Eolian_Class *klass, Eolian_Function_Type func_type); Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id); Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id, Eolian_Function_Type ftype); - const char *eolian_function_name_get(const Eolian_Function *function_id); const char *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy); const Eolian_Function *eolian_class_function_get_by_name(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type); const char *eolian_function_legacy_get(const Eolian_Function *function_id, Eolian_Function_Type f_type); @@ -367,7 +365,6 @@ ffi.cdef [[ Eolian_Parameter_Dir eolian_parameter_direction_get(const Eolian_Function_Parameter *param); const Eolian_Type *eolian_parameter_type_get(const Eolian_Function_Parameter *param); const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param); - const char *eolian_parameter_name_get(const Eolian_Function_Parameter *param); const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian_Function_Parameter *param); Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc); @@ -377,7 +374,6 @@ ffi.cdef [[ const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); Eina_Bool eolian_function_return_is_warn_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype); Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id); - const char *eolian_implement_full_name_get(const Eolian_Implement *impl); const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl); const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type); const Eolian_Documentation *eolian_implement_documentation_get(const Eolian_Implement *impl, Eolian_Function_Type f_type); @@ -387,13 +383,11 @@ ffi.cdef [[ Eina_Bool eolian_implement_is_prop_get(const Eolian_Implement *impl); Eina_Bool eolian_implement_is_prop_set(const Eolian_Implement *impl); Eina_Iterator *eolian_class_implements_get(const Eolian_Class *klass); - const char *eolian_constructor_full_name_get(const Eolian_Constructor *ctor); const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor); const Eolian_Function *eolian_constructor_function_get(const Eolian_Constructor *ctor); Eina_Bool eolian_constructor_is_optional(const Eolian_Constructor *ctor); Eina_Iterator *eolian_class_constructors_get(const Eolian_Class *klass); Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass); - const char *eolian_event_name_get(const Eolian_Event *event); const Eolian_Type *eolian_event_type_get(const Eolian_Event *event); const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event); Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event); @@ -409,12 +403,10 @@ ffi.cdef [[ Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp); Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp); const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field); - const char *eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl); const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl); const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl); Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp); const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field); - const char *eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl); const char *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl); const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force); @@ -440,15 +432,6 @@ ffi.cdef [[ const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype); const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); - const char *eolian_type_name_get(const Eolian_Type *tp); - const char *eolian_typedecl_name_get(const Eolian_Typedecl *tp); - - const char *eolian_type_full_name_get(const Eolian_Type *tp); - const char *eolian_typedecl_full_name_get(const Eolian_Typedecl *tp); - - Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp); - Eina_Iterator *eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp); - const char *eolian_type_free_func_get(const Eolian_Type *tp); const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp); @@ -469,9 +452,6 @@ ffi.cdef [[ const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); - const char *eolian_variable_name_get(const Eolian_Variable *var); - const char *eolian_variable_full_name_get(const Eolian_Variable *var); - Eina_Iterator *eolian_variable_namespaces_get(const Eolian_Variable *var); Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); const char *eolian_documentation_summary_get(const Eolian_Documentation *doc); const char *eolian_documentation_description_get(const Eolian_Documentation *doc); @@ -572,6 +552,19 @@ local object_idx = { return nil end return ffi.string(v) + end, + + short_name_get = function(self) + local v = eolian.eolian_object_short_name_get(cast_obj(self)) + if v == nil then + return nil + end + return ffi.string(v) + end, + + namespaces_get = function(self) + return iterator.String_Iterator( + eolian.eolian_object_namespaces_get(cast_obj(self))) end } ffi.metatype("Eolian_Object", { __index = object_idx }) @@ -938,12 +931,6 @@ M.c_type_type = { ffi.metatype("Eolian_Struct_Type_Field", { __index = wrap_object { - name_get = function(self) - local v = eolian.eolian_typedecl_struct_field_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - documentation_get = function(self) local v = eolian.eolian_typedecl_struct_field_documentation_get(self) if v == nil then return nil end @@ -960,12 +947,6 @@ ffi.metatype("Eolian_Struct_Type_Field", { ffi.metatype("Eolian_Enum_Type_Field", { __index = wrap_object { - name_get = function(self) - local v = eolian.eolian_typedecl_enum_field_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - c_name_get = function(self) local v = eolian.eolian_typedecl_enum_field_c_name_get(self) if v == nil then return nil end @@ -1048,23 +1029,6 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", { return ffi_stringshare(v) end, - name_get = function(self) - local v = eolian.eolian_typedecl_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - full_name_get = function(self) - local v = eolian.eolian_typedecl_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - namespaces_get = function(self) - return iterator.String_Iterator( - eolian.eolian_typedecl_namespaces_get(self)) - end, - free_func_get = function(self) local v = eolian.eolian_typedecl_free_func_get(self) if v == nil then return nil end @@ -1137,23 +1101,6 @@ M.Type = ffi.metatype("Eolian_Type", { return ffi_stringshare(v) end, - name_get = function(self) - local v = eolian.eolian_type_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - full_name_get = function(self) - local v = eolian.eolian_type_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - namespaces_get = function(self) - return iterator.String_Iterator( - eolian.eolian_type_namespaces_get(self)) - end, - free_func_get = function(self) local v = eolian.eolian_type_free_func_get(self) if v == nil then return nil end @@ -1181,12 +1128,6 @@ M.Function = ffi.metatype("Eolian_Function", { return tonumber(eolian.eolian_function_scope_get(self, ftype)) end, - name_get = function(self) - local v = eolian.eolian_function_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - full_c_name_get = function(self, ftype, use_legacy) local v = eolian.eolian_function_full_c_name_get(self, ftype, use_legacy or false) if v == nil then return nil end @@ -1294,12 +1235,6 @@ ffi.metatype("Eolian_Function_Parameter", { return v end, - name_get = function(self) - local v = eolian.eolian_parameter_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - documentation_get = function(self) local v = eolian.eolian_parameter_documentation_get(self) if v == nil then return nil end @@ -1322,12 +1257,6 @@ ffi.metatype("Eolian_Function_Parameter", { ffi.metatype("Eolian_Implement", { __index = wrap_object { - full_name_get = function(self) - local v = eolian.eolian_implement_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - class_get = function(self) local v = eolian.eolian_implement_class_get(self) if v == nil then return nil end @@ -1371,12 +1300,6 @@ ffi.metatype("Eolian_Implement", { ffi.metatype("Eolian_Constructor", { __index = wrap_object { - full_name_get = function(self) - local v = eolian.eolian_constructor_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - class_get = function(self) local v = eolian.eolian_constructor_class_get(self) if v == nil then return nil end @@ -1397,12 +1320,6 @@ ffi.metatype("Eolian_Constructor", { ffi.metatype("Eolian_Event", { __index = wrap_object { - name_get = function(self) - local v = eolian.eolian_event_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - type_get = function(self) local v = eolian.eolian_event_type_get(self) if v == nil then return nil end @@ -1449,23 +1366,6 @@ M.class_type = { M.Class = ffi.metatype("Eolian_Class", { __index = wrap_object { - full_name_get = function(self) - local v = eolian.eolian_class_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - name_get = function(self) - local v = eolian.eolian_class_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - namespaces_get = function(self) - return iterator.String_Iterator( - eolian.eolian_class_namespaces_get(self)) - end, - type_get = function(self) return tonumber(eolian.eolian_class_type_get(self)) end, @@ -1486,7 +1386,7 @@ M.Class = ffi.metatype("Eolian_Class", { local v = eolian.eolian_class_eo_prefix_get(self) if v == nil then local buf = self:namespaces_get() - buf[#buf + 1] = self:name_get() + buf[#buf + 1] = self:short_name_get() return table.concat(buf, "_"):lower() end return ffi.string(v) @@ -1746,23 +1646,6 @@ M.Variable = ffi.metatype("Eolian_Variable", { return v end, - name_get = function(self) - local v = eolian.eolian_variable_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - full_name_get = function(self) - local v = eolian.eolian_variable_full_name_get(self) - if v == nil then return nil end - return ffi.string(v) - end, - - namespaces_get = function(self) - return iterator.String_Iterator( - eolian.eolian_variable_namespaces_get(self)) - end, - is_extern = function(self) return eolian.eolian_variable_is_extern(self) ~= 0 end diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index 31f27b6c26..825ac7365e 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -38,6 +38,23 @@ M.Node = util.Object:clone { PROTECTED = eolian.object_scope.PROTECTED }, + __ctor = function(self, obj) + self._obj = obj + assert(self._obj) + end, + + name_get = function(self) + return self.obj:name_get() + end, + + short_name_get = function(self) + return self.obj:short_name_get() + end, + + namespaces_get = function(self) + return self._obj:namespaces_get():to_array() + end, + nspaces_get = function(self, root) local tbl = self:namespaces_get() -- temporary workaround @@ -48,7 +65,7 @@ M.Node = util.Object:clone { tbl[i] = tbl[i]:lower() end - tbl[#tbl + 1] = self:name_get():lower() + tbl[#tbl + 1] = self:short_name_get():lower() if root ~= nil then tbl[#tbl + 1] = not not root end @@ -90,36 +107,32 @@ local add_since = function(str, since) end M.Doc = Node:clone { - __ctor = function(self, doc) - self.doc = doc - end, - summary_get = function(self) - if not self.doc then + if not self._obj then return nil end - return self.doc:summary_get() + return self._obj:summary_get() end, description_get = function(self) - if not self.doc then + if not self._obj then return nil end - return self.doc:description_get() + return self._obj:description_get() end, since_get = function(self) - if not self.doc then + if not self._obj then return nil end - return self.doc:since_get() + return self._obj:since_get() end, brief_get = function(self, doc2) - if not self.doc and (not doc2 or not doc2.doc) then + if not self._obj and (not doc2 or not doc2._obj) then return "No description supplied." end - local doc1, doc2 = self.doc, doc2 and doc2.doc or nil + local doc1, doc2 = self._obj, doc2 and doc2._obj or nil if not doc1 then doc1, doc2 = doc2, doc1 end @@ -127,10 +140,10 @@ M.Doc = Node:clone { end, full_get = function(self, doc2, write_since) - if not self.doc and (not doc2 or not doc2.doc) then + if not self._obj and (not doc2 or not doc2._obj) then return "No description supplied." end - local doc1, doc2 = self.doc, doc2 and doc2.doc or nil + local doc1, doc2 = self._obj, doc2 and doc2._obj or nil if not doc1 then doc1, doc2 = doc2, doc1 end @@ -160,7 +173,7 @@ M.Doc = Node:clone { end, exists = function(self) - return not not self.doc + return not not self._obj end } @@ -181,25 +194,8 @@ M.Class = Node:clone { MIXIN = eolian.class_type.MIXIN, INTERFACE = eolian.class_type.INTERFACE, - __ctor = function(self, cl) - self.class = cl - assert(self.class) - end, - - full_name_get = function(self) - return self.class:full_name_get() - end, - - name_get = function(self) - return self.class:name_get() - end, - - namespaces_get = function(self) - return self.class:namespaces_get():to_array() - end, - type_get = function(self) - return self.class:type_get() + return self._obj:type_get() end, type_str_get = function(self) @@ -216,15 +212,15 @@ M.Class = Node:clone { end, doc_get = function(self) - return M.Doc(self.class:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, legacy_prefix_get = function(self) - return self.class:legacy_prefix_get() + return self._obj:legacy_prefix_get() end, eo_prefix_get = function(self) - return self.class:eo_prefix_get() + return self._obj:eo_prefix_get() end, inherits_get = function(self) @@ -233,7 +229,7 @@ M.Class = Node:clone { return ret end ret = {} - for cl in self.class:inherits_get() do + for cl in self._obj:inherits_get() do ret[#ret + 1] = M.Class(cl) end self._cache_inhc = ret @@ -241,7 +237,7 @@ M.Class = Node:clone { end, children_get = function(self) - return revh[self:full_name_get()] or {} + return revh[self:name_get()] or {} end, functions_get = function(self, ft) @@ -251,7 +247,7 @@ M.Class = Node:clone { end ret = {} self._cache_funcs = ret - for fn in self.class:functions_get(ft) do + for fn in self._obj:functions_get(ft) do ret[#ret + 1] = M.Function(fn) end return ret @@ -262,14 +258,14 @@ M.Class = Node:clone { if fun then return fun end - fun = M.Function(self.class:function_get_by_name(fn, ft)) + fun = M.Function(self._obj:function_get_by_name(fn, ft)) self._cache_func = fun return fun end, events_get = function(self) local ret = {} - for ev in self.class:events_get() do + for ev in self._obj:events_get() do ret[#ret + 1] = M.Event(ev) end return ret @@ -277,14 +273,14 @@ M.Class = Node:clone { implements_get = function(self) local ret = {} - for impl in self.class:implements_get() do + for impl in self._obj:implements_get() do ret[#ret + 1] = M.Implement(impl) end return ret end, c_get_function_name_get = function(self) - return self.class:c_get_function_name_get() + return self._obj:c_get_function_name_get() end, nspaces_get = function(self, root) @@ -292,7 +288,7 @@ M.Class = Node:clone { end, is_same = function(self, other) - return self.class == other.class + return self._obj == other._obj end, -- static getters @@ -360,17 +356,8 @@ M.Function = Node:clone { METHOD = eolian.function_type.METHOD, FUNCTION_POINTER = eolian.function_type.FUNCTION_POINTER, - __ctor = function(self, fn) - self.func = fn - assert(self.func) - end, - - name_get = function(self) - return self.func:name_get() - end, - type_get = function(self) - return self.func:type_get() + return self._obj:type_get() end, type_str_get = function(self) @@ -378,44 +365,44 @@ M.Function = Node:clone { end, scope_get = function(self, ft) - return self.func:scope_get(ft) + return self._obj:scope_get(ft) end, full_c_name_get = function(self, ft, legacy) - return self.func:full_c_name_get(ft, legacy) + return self._obj:full_c_name_get(ft, legacy) end, legacy_get = function(self, ft) - return self.func:legacy_get(ft) + return self._obj:legacy_get(ft) end, implement_get = function(self) - return M.Implement(self.func:implement_get()) + return M.Implement(self._obj:implement_get()) end, is_legacy_only = function(self, ft) - return self.func:is_legacy_only(ft) + return self._obj:is_legacy_only(ft) end, is_class = function(self) - return self.func:is_class() + return self._obj:is_class() end, is_beta = function(self) - return self.func:is_beta() + return self._obj:is_beta() end, is_constructor = function(self, klass) - return self.func:is_constructor(klass.class) + return self._obj:is_constructor(klass.class) end, is_function_pointer = function(self) - return self.func:is_function_pointer() + return self._obj:is_function_pointer() end, property_keys_get = function(self, ft) local ret = {} - for par in self.func:property_keys_get(ft) do + for par in self._obj:property_keys_get(ft) do ret[#ret + 1] = M.Parameter(par) end return ret @@ -423,7 +410,7 @@ M.Function = Node:clone { property_values_get = function(self, ft) local ret = {} - for par in self.func:property_values_get(ft) do + for par in self._obj:property_values_get(ft) do ret[#ret + 1] = M.Parameter(par) end return ret @@ -431,14 +418,14 @@ M.Function = Node:clone { parameters_get = function(self) local ret = {} - for par in self.func:parameters_get() do + for par in self._obj:parameters_get() do ret[#ret + 1] = M.Parameter(par) end return ret end, return_type_get = function(self, ft) - local v = self.func:return_type_get(ft) + local v = self._obj:return_type_get(ft) if not v then return nil end @@ -446,7 +433,7 @@ M.Function = Node:clone { end, return_default_value_get = function(self, ft) - local v = self.func:return_default_value_get(ft) + local v = self._obj:return_default_value_get(ft) if not v then return nil end @@ -454,15 +441,15 @@ M.Function = Node:clone { end, return_doc_get = function(self, ft) - return M.Doc(self.func:return_documentation_get(ft)) + return M.Doc(self._obj:return_documentation_get(ft)) end, return_is_warn_unused = function(self, ft) - return self.func:return_is_warn_unused(ft) + return self._obj:return_is_warn_unused(ft) end, is_const = function(self) - return self.func:is_const() + return self._obj:is_const() end, nspaces_get = function(self, cl, root) @@ -476,11 +463,11 @@ M.Function = Node:clone { end, is_same = function(self, other) - return self.func == other.func + return self._obj == other._obj end, id_get = function(self) - return tonumber(ffi.cast("uintptr_t", self.func)) + return tonumber(ffi.cast("uintptr_t", self._obj)) end } @@ -490,13 +477,8 @@ M.Parameter = Node:clone { OUT = eolian.parameter_dir.OUT, INOUT = eolian.parameter_dir.INOUT, - __ctor = function(self, par) - self.param = par - assert(self.param) - end, - direction_get = function(self) - return self.param:direction_get() + return self._obj:direction_get() end, direction_name_get = function(self) @@ -510,7 +492,7 @@ M.Parameter = Node:clone { end, type_get = function(self) - local v = self.param:type_get() + local v = self._obj:type_get() if not v then return nil end @@ -518,50 +500,37 @@ M.Parameter = Node:clone { end, default_value_get = function(self) - local v = self.param:default_value_get() + local v = self._obj:default_value_get() if not v then return nil end return M.Expression(v) end, - name_get = function(self) - return self.param:name_get() - end, - doc_get = function(self) - return M.Doc(self.param:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, is_nonull = function(self) - return self.param:is_nonull() + return self._obj:is_nonull() end, is_nullable = function(self) - return self.param:is_nullable() + return self._obj:is_nullable() end, is_optional = function(self) - return self.param:is_optional() + return self._obj:is_optional() end, is_same = function(self, other) - return self.param == other.param + return self._obj == other._obj end } M.Event = Node:clone { - __ctor = function(self, ev) - self.event = ev - assert(self.event) - end, - - name_get = function(self) - return self.event:name_get() - end, - type_get = function(self) - local v = self.event:type_get() + local v = self._obj:type_get() if not v then return nil end @@ -569,27 +538,27 @@ M.Event = Node:clone { end, doc_get = function(self) - return M.Doc(self.event:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, scope_get = function(self) - return self.event:scope_get() + return self._obj:scope_get() end, c_name_get = function(self) - return self.event:c_name_get() + return self._obj:c_name_get() end, is_beta = function(self) - return self.event:is_beta() + return self._obj:is_beta() end, is_hot = function(self) - return self.event:is_hot() + return self._obj:is_hot() end, is_restart = function(self) - return self.event:is_restart() + return self._obj:is_restart() end, nspaces_get = function(self, cl, root) @@ -604,21 +573,12 @@ M.Event = Node:clone { } M.StructField = Node:clone { - __ctor = function(self, fl) - self.field = fl - assert(self.field) - end, - - name_get = function(self) - return self.field:name_get() - end, - doc_get = function(self) - return M.Doc(self.field:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, type_get = function(self) - local v = self.field:type_get() + local v = self._obj:type_get() if not v then return nil end @@ -627,25 +587,16 @@ M.StructField = Node:clone { } M.EnumField = Node:clone { - __ctor = function(self, fl) - self.field = fl - assert(self.field) - end, - - name_get = function(self) - return self.field:name_get() - end, - c_name_get = function(self) - return self.field:c_name_get() + return self._obj:c_name_get() end, doc_get = function(self) - return M.Doc(self.field:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, value_get = function(self, force) - local v = self.field:value_get(force) + local v = self._obj:value_get(force) if not v then return nil end @@ -678,21 +629,16 @@ M.Type = Node:clone { CLASS = eolian.type_type.CLASS, UNDEFINED = eolian.type_type.UNDEFINED, - __ctor = function(self, tp) - self.type = tp - assert(self.type) - end, - type_get = function(self) - return self.type:type_get() + return self._obj:type_get() end, file_get = function(self) - return self.type:file_get() + return self._obj:file_get() end, base_type_get = function(self) - local v = self.type:base_type_get() + local v = self._obj:base_type_get() if not v then return nil end @@ -700,7 +646,7 @@ M.Type = Node:clone { end, next_type_get = function(self) - local v = self.type:next_type_get() + local v = self._obj:next_type_get() if not v then return nil end @@ -708,7 +654,7 @@ M.Type = Node:clone { end, typedecl_get = function(self) - local v = self.type:typedecl_get() + local v = self._obj:typedecl_get() if not v then return nil end @@ -716,7 +662,7 @@ M.Type = Node:clone { end, aliased_base_get = function(self) - local v = self.type:aliased_base_get() + local v = self._obj:aliased_base_get() if not v then return nil end @@ -725,39 +671,27 @@ M.Type = Node:clone { class_get = function(self) -- FIXME: unit - return self.type:class_get(eos:unit_get()) + return self._obj:class_get(eos:unit_get()) end, is_owned = function(self) - return self.type:is_owned() + return self._obj:is_owned() end, is_const = function(self) - return self.type:is_const() + return self._obj:is_const() end, is_ptr = function(self) - return self.type:is_ptr() + return self._obj:is_ptr() end, c_type_get = function(self) - return self.type:c_type_get(eolian.c_type_type.DEFAULT) - end, - - name_get = function(self) - return self.type:name_get() - end, - - full_name_get = function(self) - return self.type:full_name_get() - end, - - namespaces_get = function(self) - return self.type:namespaces_get() + return self._obj:c_type_get(eolian.c_type_type.DEFAULT) end, free_func_get = function(self) - return self.type:free_func_get() + return self._obj:free_func_get() end, -- utils @@ -765,7 +699,7 @@ M.Type = Node:clone { serialize = function(self) local tpt = self:type_get() if tpt == self.UNKNOWN then - error("unknown type: " .. self:full_name_get()) + error("unknown type: " .. self:name_get()) elseif tpt == self.VOID then return wrap_type_attrs(self, "void") elseif tpt == self.UNDEFINED then @@ -778,10 +712,10 @@ M.Type = Node:clone { stypes[#stypes + 1] = stp:serialize() stp = stp:next_type_get() end - return wrap_type_attrs(self, self:full_name_get() .. "<" + return wrap_type_attrs(self, self:name_get() .. "<" .. table.concat(stypes, ", ") .. ">") end - return wrap_type_attrs(self, self:full_name_get()) + return wrap_type_attrs(self, self:name_get()) end error("unhandled type type: " .. tpt) end @@ -820,13 +754,8 @@ M.Typedecl = Node:clone { ALIAS = eolian.typedecl_type.ALIAS, FUNCTION_POINTER = eolian.typedecl_type.FUNCTION_POINTER, - __ctor = function(self, tp) - self.typedecl = tp - assert(self.typedecl) - end, - type_get = function(self) - return self.typedecl:type_get() + return self._obj:type_get() end, type_str_get = function(self) @@ -841,14 +770,14 @@ M.Typedecl = Node:clone { struct_fields_get = function(self) local ret = {} - for fl in self.typedecl:struct_fields_get() do + for fl in self._obj:struct_fields_get() do ret[#ret + 1] = M.StructField(fl) end return ret end, struct_field_get = function(self, name) - local v = self.typedecl:struct_field_get(name) + local v = self._obj:struct_field_get(name) if not v then return nil end @@ -857,14 +786,14 @@ M.Typedecl = Node:clone { enum_fields_get = function(self) local ret = {} - for fl in self.typedecl:enum_fields_get() do + for fl in self._obj:enum_fields_get() do ret[#ret + 1] = M.EnumField(fl) end return ret end, enum_field_get = function(self, name) - local v = self.typedecl:enum_field_get(name) + local v = self._obj:enum_field_get(name) if not v then return nil end @@ -872,19 +801,19 @@ M.Typedecl = Node:clone { end, enum_legacy_prefix_get = function(self) - return self.typedecl:enum_legacy_prefix_get() + return self._obj:enum_legacy_prefix_get() end, doc_get = function(self) - return M.Doc(self.typedecl:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, file_get = function(self) - return self.typedecl:file_get() + return self._obj:file_get() end, base_type_get = function(self) - local v = self.typedecl:base_type_get() + local v = self._obj:base_type_get() if not v then return nil end @@ -892,7 +821,7 @@ M.Typedecl = Node:clone { end, aliased_base_get = function(self) - local v = self.typedecl:aliased_base_get() + local v = self._obj:aliased_base_get() if not v then return nil end @@ -900,31 +829,19 @@ M.Typedecl = Node:clone { end, is_extern = function(self) - return self.typedecl:is_extern() + return self._obj:is_extern() end, c_type_get = function(self) - return self.typedecl:c_type_get() - end, - - name_get = function(self) - return self.typedecl:name_get() - end, - - full_name_get = function(self) - return self.typedecl:full_name_get() - end, - - namespaces_get = function(self) - return self.typedecl:namespaces_get():to_array() + return self._obj:c_type_get() end, free_func_get = function(self) - return self.typedecl:free_func_get() + return self._obj:free_func_get() end, function_pointer_get = function(self) - local v = self.typedecl:function_pointer_get() + local v = self._obj:function_pointer_get() if not v then return nil end @@ -1024,12 +941,12 @@ M.Typedecl = Node:clone { serialize = function(self) local tpt = self:type_get() if tpt == self.UNKNOWN then - error("unknown typedecl: " .. self:full_name_get()) + error("unknown typedecl: " .. self:name_get()) elseif tpt == self.STRUCT or tpt == self.STRUCT_OPAQUE then local buf = { "struct " } add_typedecl_attrs(self, buf) - buf[#buf + 1] = self:full_name_get() + buf[#buf + 1] = self:name_get() if tpt == self.STRUCT_OPAQUE then buf[#buf + 1] = ";" return table.concat(buf) @@ -1052,7 +969,7 @@ M.Typedecl = Node:clone { elseif tpt == self.ENUM then local buf = { "enum " } add_typedecl_attrs(self, buf) - buf[#buf + 1] = self:full_name_get() + buf[#buf + 1] = self:name_get() local fields = self:enum_fields_get() if #fields == 0 then buf[#buf + 1] = " {}" @@ -1078,7 +995,7 @@ M.Typedecl = Node:clone { elseif tpt == self.ALIAS then local buf = { "type " } add_typedecl_attrs(self, buf) - buf[#buf + 1] = self:full_name_get() + buf[#buf + 1] = self:name_get() buf[#buf + 1] = ": " buf[#buf + 1] = self:base_type_get():serialize() buf[#buf + 1] = ";" @@ -1092,11 +1009,11 @@ M.Typedecl = Node:clone { serialize_c = function(self, ns) local tpt = self:type_get() if tpt == self.UNKNOWN then - error("unknown typedecl: " .. self:full_name_get()) + error("unknown typedecl: " .. self:name_get()) elseif tpt == self.STRUCT or tpt == self.STRUCT_OPAQUE then local buf = { "typedef struct " } - local fulln = self:full_name_get():gsub("%.", "_"); + local fulln = self:name_get():gsub("%.", "_"); keyref.add(fulln, ns, "c") buf[#buf + 1] = "_" .. fulln; if tpt == self.STRUCT_OPAQUE then @@ -1118,7 +1035,7 @@ M.Typedecl = Node:clone { return table.concat(buf) elseif tpt == self.ENUM then local buf = { "typedef enum" } - local fulln = self:full_name_get():gsub("%.", "_"); + local fulln = self:name_get():gsub("%.", "_"); keyref.add(fulln, ns, "c") local fields = self:enum_fields_get() if #fields == 0 then @@ -1151,7 +1068,7 @@ M.Typedecl = Node:clone { buf[#buf + 1] = "} " .. fulln .. ";" return table.concat(buf) elseif tpt == self.ALIAS then - local fulln = self:full_name_get():gsub("%.", "_"); + local fulln = self:name_get():gsub("%.", "_"); keyref.add(fulln, ns, "c") return "typedef " .. M.type_cstr_get(self:base_type_get(), fulln) .. ";" @@ -1167,13 +1084,8 @@ M.Variable = Node:clone { CONSTANT = eolian.variable_type.CONSTANT, GLOBAL = eolian.variable_type.GLOBAL, - __ctor = function(self, var) - self.variable = var - assert(self.variable) - end, - type_get = function(self) - return self.variable:type_get() + return self._obj:type_get() end, type_str_get = function(self) @@ -1185,15 +1097,15 @@ M.Variable = Node:clone { end, doc_get = function(self) - return M.Doc(self.variable:documentation_get()) + return M.Doc(self._obj:documentation_get()) end, file_get = function(self) - return self.variable:file_get() + return self._obj:file_get() end, base_type_get = function(self) - local v = self.variable:base_type_get() + local v = self._obj:base_type_get() if not v then return nil end @@ -1201,27 +1113,15 @@ M.Variable = Node:clone { end, value_get = function(self) - local v = self.variable:value_get() + local v = self._obj:value_get() if not v then return nil end return M.Expression(v) end, - name_get = function(self) - return self.variable:name_get() - end, - - full_name_get = function(self) - return self.variable:full_name_get() - end, - - namespaces_get = function(self) - return self.variable:namespaces_get():to_array() - end, - is_extern = function(self) - return self.variable:is_extern() + return self._obj:is_extern() end, nspaces_get = function(self, root) @@ -1238,7 +1138,7 @@ M.Variable = Node:clone { if self:is_extern() then buf[#buf + 1] = "@extern " end - buf[#buf + 1] = self:full_name_get() + buf[#buf + 1] = self:name_get() buf[#buf + 1] = ": " buf[#buf + 1] = self:base_type_get():serialize() local val = self:value_get() @@ -1253,7 +1153,7 @@ M.Variable = Node:clone { serialize_c = function(self, ns) local buf = {} local bt = self:base_type_get() - local fulln = self:full_name_get():gsub("%.", "_"):upper() + local fulln = self:name_get():gsub("%.", "_"):upper() keyref.add(fulln, ns, "c") if self:type_get() == self.GLOBAL then local ts = bt:c_type_get() @@ -1342,41 +1242,27 @@ M.Variable = Node:clone { } M.Expression = Node:clone { - __ctor = function(self, expr) - self.expr = expr - assert(self.expr) - end, - eval_enum = function(self) - return self.expr:eval(eolian.expression_mask.INT) + return self._obj:eval(eolian.expression_mask.INT) end, eval_type = function(self, tp) - return self.expr:eval_type(tp.type) + return self._obj:eval_type(tp.type) end, serialize = function(self) - return self.expr:serialize() + return self._obj:serialize() end } M.Implement = Node:clone { - __ctor = function(self, impl) - self.impl = impl - assert(self.impl) - end, - - full_name_get = function(self) - return self.impl:full_name_get() - end, - class_get = function(self) local ccl = self._cache_cl if ccl then return ccl end -- so that we don't re-instantiate, it gets cached over there too - ccl = M.Class.by_name_get(self.impl:class_get():full_name_get()) + ccl = M.Class.by_name_get(self._obj:class_get():name_get()) self._cache_cl = ccl return ccl end, @@ -1386,14 +1272,14 @@ M.Implement = Node:clone { if func then return func, tp end - func, tp = self.impl:function_get() + func, tp = self._obj:function_get() func = M.Function(func) self._cache_func, self._cache_tp = func, tp return func, tp end, doc_get = function(self, ftype, inh) - return M.Doc(self.impl:documentation_get(ftype)) + return M.Doc(self._obj:documentation_get(ftype)) end, fallback_doc_get = function(self, inh) @@ -1407,31 +1293,31 @@ M.Implement = Node:clone { end, is_auto = function(self, ftype) - return self.impl:is_auto(ftype) + return self._obj:is_auto(ftype) end, is_empty = function(self, ftype) - return self.impl:is_empty(ftype) + return self._obj:is_empty(ftype) end, is_pure_virtual = function(self, ftype) - return self.impl:is_pure_virtual(ftype) + return self._obj:is_pure_virtual(ftype) end, is_prop_get = function(self) - return self.impl:is_prop_get() + return self._obj:is_prop_get() end, is_prop_set = function(self) - return self.impl:is_prop_set() + return self._obj:is_prop_set() end, is_overridden = function(self, cl) - return cl.class ~= self.impl:class_get() + return cl.class ~= self._obj:class_get() end } -M.DocTokenizer = Node:clone { +M.DocTokenizer = util.Object:clone { UNKNOWN = eolian.doc_token_type.UNKNOWN, TEXT = eolian.doc_token_type.TEXT, REF = eolian.doc_token_type.REF, @@ -1469,7 +1355,7 @@ M.DocTokenizer = Node:clone { if tp == reft.CLASS or tp == reft.FUNC or tp == reft.EVENT then if not class_type_str[d1:type_get()] then error("unknown class type for class '" - .. d1:full_name_get() .. "'") + .. d1:name_get() .. "'") end elseif tp == reft.ALIAS then elseif tp == reft.STRUCT or tp == reft.STRUCT_FIELD then @@ -1480,7 +1366,7 @@ M.DocTokenizer = Node:clone { else error("invalid reference '" .. self:text_get() .. "'") end - for tok in d1:full_name_get():gmatch("[^%.]+") do + for tok in d1:name_get():gmatch("[^%.]+") do ret[#ret + 1] = tok:lower() end if tp == reft.FUNC then @@ -1524,14 +1410,14 @@ M.parse = function(st) end -- build reverse inheritance hierarchy for cl in eos:classes_get() do - local cln = cl:full_name_get() + local cln = cl:name_get() for icl in cl:inherits_get() do local t = revh[icl] if not t then t = {} revh[icl] = t end - t[#t + 1] = M.Class.by_name_get(cl:full_name_get()) + t[#t + 1] = M.Class.by_name_get(cl:name_get()) end end end diff --git a/src/scripts/elua/apps/docgen/stats.lua b/src/scripts/elua/apps/docgen/stats.lua index 5bbc592333..9659f86dcd 100644 --- a/src/scripts/elua/apps/docgen/stats.lua +++ b/src/scripts/elua/apps/docgen/stats.lua @@ -119,7 +119,7 @@ M.check_class = function(cl) return end if not cl:doc_get():exists() then - print_missing(cl:full_name_get(), ct) + print_missing(cl:name_get(), ct) stat_incr(ct, true) else stat_incr(ct, false) @@ -127,7 +127,7 @@ M.check_class = function(cl) for i, ev in ipairs(cl:events_get()) do if not ev:doc_get():exists() then - print_missing(cl:full_name_get() .. "." .. ev:name_get(), "event") + print_missing(cl:name_get() .. "." .. ev:name_get(), "event") stat_incr("event", true) else stat_incr("event", false) @@ -136,7 +136,7 @@ M.check_class = function(cl) end M.check_method = function(fn, cl) - local fulln = cl:full_name_get() .. "." .. fn:name_get() + local fulln = cl:name_get() .. "." .. fn:name_get() if fn:return_type_get(fn.METHOD) then if not fn:return_doc_get(fn.METHOD):exists() then print_missing(fulln, "method return") @@ -168,7 +168,7 @@ M.check_property = function(fn, cl, ft) } local pfx = pfxs[ft] - local fulln = cl:full_name_get() .. "." .. fn:name_get() + local fulln = cl:name_get() .. "." .. fn:name_get() if fn:return_type_get(ft) then if not fn:return_doc_get(ft):exists() then print_missing(fulln, pfx .. "etter return") @@ -208,7 +208,7 @@ end M.check_alias = function(v) if not v:doc_get():exists() then - print_missing(v:full_name_get(), "alias") + print_missing(v:name_get(), "alias") stat_incr("alias", true) else stat_incr("alias", false) @@ -217,14 +217,14 @@ end M.check_struct = function(v) if not v:doc_get():exists() then - print_missing(v:full_name_get(), "struct") + print_missing(v:name_get(), "struct") stat_incr("struct", true) else stat_incr("struct", false) end for i, fl in ipairs(v:struct_fields_get()) do if not fl:doc_get():exists() then - print_missing(v:full_name_get() .. "." .. fl:name_get(), "struct field") + print_missing(v:name_get() .. "." .. fl:name_get(), "struct field") stat_incr("sfield", true) else stat_incr("sfield", false) @@ -234,14 +234,14 @@ end M.check_enum = function(v) if not v:doc_get():exists() then - print_missing(v:full_name_get(), "enum") + print_missing(v:name_get(), "enum") stat_incr("enum", true) else stat_incr("enum", false) end for i, fl in ipairs(v:enum_fields_get()) do if not fl:doc_get():exists() then - print_missing(v:full_name_get() .. "." .. fl:name_get(), "enum field") + print_missing(v:name_get() .. "." .. fl:name_get(), "enum field") stat_incr("efield", true) else stat_incr("efield", false) @@ -251,7 +251,7 @@ end M.check_constant = function(v) if not v:doc_get():exists() then - print_missing(v:full_name_get(), "constant") + print_missing(v:name_get(), "constant") stat_incr("constant", true) else stat_incr("constant", false) @@ -260,7 +260,7 @@ end M.check_global = function(v) if not v:doc_get():exists() then - print_missing(v:full_name_get(), "global") + print_missing(v:name_get(), "global") stat_incr("global", true) else stat_incr("global", false) diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 3ae12e1191..6e81595556 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -342,7 +342,7 @@ local build_reftable = function(f, title, ctype, t, iscl) writer.Buffer():write_link( iscl and v:nspaces_get(true) or dtree.Node.nspaces_get(v, true), - v:full_name_get() + v:name_get() ):finish(), v:doc_get():brief_get() } @@ -428,7 +428,7 @@ build_inherits = function(cl, t, lvl) lvl = lvl or 0 local lbuf = writer.Buffer() if lvl > 0 then - lbuf:write_link(cl:nspaces_get(true), cl:full_name_get()) + lbuf:write_link(cl:nspaces_get(true), cl:name_get()) lbuf:write_raw(" ") lbuf:write_i("(" .. cl:type_str_get() .. ")") @@ -446,7 +446,7 @@ build_inherit_summary = function(cl, buf) buf = buf or writer.Buffer() buf:write_raw(" => ") - buf:write_link(cl:nspaces_get(true), cl:full_name_get()) + buf:write_link(cl:nspaces_get(true), cl:name_get()) buf:write_raw(" ") buf:write_i("(" .. cl:type_str_get() .. ")") @@ -671,7 +671,7 @@ local find_parent_impl find_parent_impl = function(fulln, cl) for i, pcl in ipairs(cl:inherits_get()) do for j, impl in ipairs(pcl:implements_get()) do - if impl:full_name_get() == fulln then + if impl:name_get() == fulln then return impl, pcl end end @@ -734,7 +734,7 @@ local build_functable = function(f, tcl, tbl) table.sort(nt, function(v1, v2) local cl1, cl2 = v1[0], v2[0] if cl1 ~= cl2 then - return cl1:full_name_get() < cl2:full_name_get() + return cl1:name_get() < cl2:name_get() end local f1, f2 = v1[1], v2[1] @@ -761,7 +761,7 @@ local write_description = function(f, impl, func, cl) local doc = impl:doc_get(func.METHOD, true) local docf = impl:fallback_doc_get(true) if over and (not doc:exists() and (not docf or not docf:exists())) then - bdoc = find_parent_briefdoc(impl:full_name_get(), cl) + bdoc = find_parent_briefdoc(impl:name_get(), cl) else bdoc = doc:brief_get(docf) end @@ -847,7 +847,7 @@ local write_functable = function(f, tcl, tbl) -- but we get latest doc every time so it's ok for now local llbuf = writer.Buffer() llbuf:write_raw(" [Overridden from ") - llbuf:write_link(ocl:nspaces_get(true), ocl:full_name_get()) + llbuf:write_link(ocl:nspaces_get(true), ocl:name_get()) llbuf:write_raw("]") f:write_i(llbuf:finish()) end @@ -899,7 +899,7 @@ local write_inherit_functable = function(f, tcl, tbl) if cl ~= prevcl then prevcl = cl f:write_raw("^ ") - f:write_link(cl:nspaces_get(true), cl:full_name_get()) + f:write_link(cl:nspaces_get(true), cl:name_get()) f:write_raw(" ^^^") f:write_nl() end @@ -984,7 +984,7 @@ local build_evtable = function(f, tcl, tbl, newm) table.sort(nt, function(v1, v2) if v1[0] ~= v2[0] then - return v1[0]:full_name_get() < v2[0]:full_name_get() + return v1[0]:name_get() < v2[0]:name_get() end return v1[2] < v2[2] @@ -1053,7 +1053,7 @@ local write_inherit_evtable = function(f, tcl, tbl) if cl ~= prevcl then prevcl = cl f:write_raw("^ ") - f:write_link(cl:nspaces_get(true), cl:full_name_get()) + f:write_link(cl:nspaces_get(true), cl:name_get()) f:write_raw(" ^^^") f:write_nl() end @@ -1080,11 +1080,11 @@ end local build_class = function(cl) local cln = cl:nspaces_get() - local fulln = cl:full_name_get() + local fulln = cl:name_get() local f = writer.Writer(cln, fulln) printgen("Generating class: " .. fulln) - f:write_h(cl:full_name_get() .. " (" .. cl:type_str_get() .. ")", 1) + f:write_h(cl:name_get() .. " (" .. cl:type_str_get() .. ")", 1) f:write_h("Description", 2) f:write_raw(cl:doc_get():full_get(nil, true)) @@ -1151,7 +1151,7 @@ end local build_alias = function(tp) local ns = dtree.Node.nspaces_get(tp) - local fulln = tp:full_name_get() + local fulln = tp:name_get() local f = writer.Writer(ns, fulln) printgen("Generating alias: " .. fulln) @@ -1169,7 +1169,7 @@ end local build_struct = function(tp) local ns = dtree.Node.nspaces_get(tp) - local fulln = tp:full_name_get() + local fulln = tp:name_get() local f = writer.Writer(ns, fulln) printgen("Generating struct: " .. fulln) @@ -1202,7 +1202,7 @@ end local build_enum = function(tp) local ns = dtree.Node.nspaces_get(tp) - local fulln = tp:full_name_get() + local fulln = tp:name_get() local f = writer.Writer(ns, fulln) printgen("Generating enum: " .. fulln) @@ -1235,7 +1235,7 @@ end local build_variable = function(v, constant) local ns = v:nspaces_get() - local fulln = v:full_name_get() + local fulln = v:name_get() local f = writer.Writer(ns, fulln) printgen("Generating variable: " .. fulln) @@ -1337,9 +1337,9 @@ local write_inherited_from = function(f, impl, cl, over, prop) end local buf = writer.Buffer() buf:write_raw("Overridden from ") - local pimpl, pcl = find_parent_impl(impl:full_name_get(), cl) + local pimpl, pcl = find_parent_impl(impl:name_get(), cl) buf:write_link( - impl:function_get():nspaces_get(pcl, true), impl:full_name_get() + impl:function_get():nspaces_get(pcl, true), impl:name_get() ) if prop then buf:write_raw(" ") @@ -1365,7 +1365,7 @@ local impls_of = {} local get_all_impls_of get_all_impls_of = function(tbl, cl, fn, got) - local cfn = cl:full_name_get() + local cfn = cl:name_get() if got[cfn] then return end @@ -1386,7 +1386,7 @@ local write_ilist = function(f, impl, cl) local fn = impl:function_get() local fnn = fn:name_get() local ocl = fn:implement_get():class_get() - local onm = ocl:full_name_get() .. "." .. fnn + local onm = ocl:name_get() .. "." .. fnn local imps = impls_of[onm] if not imps then imps = {} @@ -1398,7 +1398,7 @@ local write_ilist = function(f, impl, cl) local t = {} for i, icl in ipairs(imps) do local buf = writer.Buffer() - local cfn = icl:full_name_get() .. "." .. fnn + local cfn = icl:name_get() .. "." .. fnn if icl:is_same(cl) then buf:write_b(cfn) else @@ -1413,13 +1413,13 @@ build_method = function(impl, cl) local over = impl:is_overridden(cl) local fn = impl:function_get() local mns = fn:nspaces_get(cl) - local methn = cl:full_name_get() .. "." .. fn:name_get() + local methn = cl:name_get() .. "." .. fn:name_get() local f = writer.Writer(mns, methn) printgen("Generating method: " .. methn) local doc = impl:doc_get(fn.METHOD) if over and not doc:exists() then - doc = find_parent_doc(impl:full_name_get(), cl, fn.METHOD) + doc = find_parent_doc(impl:name_get(), cl, fn.METHOD) end f:write_h("Description", 2) @@ -1456,7 +1456,7 @@ build_property = function(impl, cl) local over = impl:is_overridden(cl) local fn = impl:function_get() local pns = fn:nspaces_get(cl) - local propn = cl:full_name_get() .. "." .. fn:name_get() + local propn = cl:name_get() .. "." .. fn:name_get() local f = writer.Writer(pns, propn) printgen("Generating property: " .. propn) @@ -1471,13 +1471,13 @@ build_property = function(impl, cl) if over then if not doc:exists() then - doc = find_parent_doc(impl:full_name_get(), cl, fn.PROPERTY) + doc = find_parent_doc(impl:name_get(), cl, fn.PROPERTY) end if isget and not gdoc:exists() then - gdoc = find_parent_doc(impl:full_name_get(), cl, fn.PROP_GET) + gdoc = find_parent_doc(impl:name_get(), cl, fn.PROP_GET) end if isset and not sdoc:exists() then - sdoc = find_parent_doc(impl:full_name_get(), cl, fn.PROP_SET) + sdoc = find_parent_doc(impl:name_get(), cl, fn.PROP_SET) end end @@ -1592,7 +1592,7 @@ end build_event = function(ev, cl) local evn = ev:nspaces_get(cl) - local evnm = cl:full_name_get() .. ": " .. ev:name_get() + local evnm = cl:name_get() .. ": " .. ev:name_get() local f = writer.Writer(evn, evnm) printgen("Generating event: " .. evnm) @@ -1646,7 +1646,7 @@ end local build_stats_keyref = function() for i, cl in ipairs(dtree.Class.all_get()) do stats.check_class(cl) - keyref.add(cl:full_name_get():gsub("%.", "_"), cl:nspaces_get(), "c") + keyref.add(cl:name_get():gsub("%.", "_"), cl:nspaces_get(), "c") for i, imp in ipairs(cl:implements_get()) do -- TODO: handle doc overrides in stats system if not imp:is_overridden(cl) then @@ -1753,7 +1753,7 @@ getopt.parse { if st == "clist" then for i, cl in ipairs(dtree.Class.all_get()) do - print(cl:full_name_get()) + print(cl:name_get()) end return end diff --git a/src/scripts/elua/modules/lualian.lua b/src/scripts/elua/modules/lualian.lua index 959b4fd837..e515aaf8bc 100644 --- a/src/scripts/elua/modules/lualian.lua +++ b/src/scripts/elua/modules/lualian.lua @@ -107,7 +107,7 @@ local typeconv = function(tps, expr, isin) return build_calln(tps, expr, isin) end - local tp = tps:name_get() + local tp = tps:short_name_get() if is_num(tp) then return isin and expr or ("tonumber(%s)"):format(expr) @@ -407,7 +407,7 @@ local Mixin = Node:clone { generate = function(self, s) dom:log(log.level.INFO, " Generating for interface/mixin: " - .. self.klass:full_name_get()) + .. self.klass:name_get()) s:write("ffi.cdef [[\n") self:gen_ffi(s) @@ -419,7 +419,7 @@ local Mixin = Node:clone { self:gen_children(s) s:write("}\n") - local knu = self.klass:full_name_get():gsub("%.", "_") + local knu = self.klass:name_get():gsub("%.", "_") if not self.iface then s:write(("__body[\"__mixin_%s\"] = true\n"):format(knu)) else @@ -462,7 +462,7 @@ local Class = Node:clone { generate = function(self, s) dom:log(log.level.INFO, " Generating for class: " - .. self.klass:full_name_get()) + .. self.klass:name_get()) s:write("ffi.cdef [[\n") self:gen_ffi(s) @@ -482,7 +482,7 @@ local Class = Node:clone { return eo.__ctor_common(__class, parent, eo.class_get("%s").__eo_ctor, 1, ...) end -]]):format(mname, self.klass:name_get(), self.klass:full_name_get():gsub("%.", +]]):format(mname, self.klass:short_name_get(), self.klass:name_get():gsub("%.", "_"))) end, @@ -572,7 +572,7 @@ local File = Node:clone { local kls = self.klass local ckls = self.children[1] - local kn = kls:full_name_get() + local kn = kls:name_get() dom:log(log.level.INFO, "Generating for file: " .. self.fname) dom:log(log.level.INFO, " Class : " .. kn) @@ -669,7 +669,7 @@ end local gen_class = function(klass) local tp = klass:type_get() if tp == class_type.UNKNOWN then - error(klass:full_name_get() .. ": unknown type") + error(klass:name_get() .. ": unknown type") elseif tp == class_type.MIXIN or tp == class_type.INTERFACE then return Mixin(tp == class_type.INTERFACE, klass, gen_contents(klass)) end @@ -684,7 +684,7 @@ local gen_class = function(klass) elseif tp == class_type.INTERFACE or tp == class_type.MIXIN then mixins[#mixins + 1] = v else - error(klass:full_name_get() .. ": unknown inherit " .. v) + error(klass:name_get() .. ": unknown inherit " .. v) end end return Class(klass, parents, mixins, gen_contents(klass))