end
}
+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())
+ end,
+
+ type_get = function(self)
+ return self.field:type_get()
+ end
+}
+
+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()
+ end,
+
+ doc_get = function(self)
+ return M.Doc(self.field:documentation_get())
+ end,
+
+ value_get = function(self, force)
+ return self.field:value_get(force)
+ end
+}
+
M.Typedecl = Node:clone {
UNKNOWN = eolian.typedecl_type.UNKNOWN,
STRUCT = eolian.typedecl_type.STRUCT,
end,
struct_fields_get = function(self)
- return self.typedecl:struct_fields_get():to_array()
+ local ret = {}
+ for fl in self.typedecl:struct_fields_get() do
+ ret[#ret + 1] = M.StructField(fl)
+ end
+ return ret
end,
struct_field_get = function(self, name)
- return self.typedecl:struct_field_get(name)
+ local v = self.typedecl:struct_field_get(name)
+ if not v then
+ return nil
+ end
+ return M.StructField(v)
end,
enum_fields_get = function(self)
- return self.typedecl:enum_fields_get():to_array()
+ local ret = {}
+ for fl in self.typedecl:enum_fields_get() do
+ ret[#ret + 1] = M.EnumField(fl)
+ end
+ return ret
end,
enum_field_get = function(self, name)
- return self.typedecl:enum_field_get(name)
+ local v = self.typedecl:enum_field_get(name)
+ if not v then
+ return nil
+ end
+ return M.EnumField(v)
end,
enum_legacy_prefix_get = function(self)
stat_incr("struct", false)
end
for i, fl in ipairs(v:struct_fields_get()) do
- if not fl:documentation_get() then
+ if not fl:doc_get():exists() then
print_missing(v:full_name_get() .. "." .. fl:name_get(), "struct field")
stat_incr("sfield", true)
else
stat_incr("enum", false)
end
for i, fl in ipairs(v:enum_fields_get()) do
- if not fl:documentation_get() then
+ if not fl:doc_get():exists() then
print_missing(v:full_name_get() .. "." .. fl:name_get(), "enum field")
stat_incr("efield", true)
else
local ser = require("docgen.serializers")
local dtree = require("docgen.doctree")
--- eolian to various doc elements conversions
-
local propt_to_type = {
[dtree.Function.PROPERTY] = "(get, set)",
[dtree.Function.PROP_GET] = "(get)",
for i, fl in ipairs(tp:struct_fields_get()) do
local buf = writer.Buffer()
buf:write_b(fl:name_get())
- buf:write_raw(" - ", dtree.Doc(fl:documentation_get()):full_get())
+ buf:write_raw(" - ", fl:doc_get():full_get())
arr[#arr + 1] = buf:finish()
end
f:write_list(arr)
for i, fl in ipairs(tp:enum_fields_get()) do
local buf = writer.Buffer()
buf:write_b(fl:name_get())
- buf:write_raw(" - ", dtree.Doc(fl:documentation_get()):full_get())
+ buf:write_raw(" - ", fl:doc_get():full_get())
arr[#arr + 1] = buf:finish()
end
f:write_list(arr)