mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
autodoc: Handling of default values for struct fields
This commit is contained in:
committed by
Loris Cro
parent
83d1f6b15a
commit
97b3b36c65
+12
-5
@@ -2860,7 +2860,7 @@ const NAV_MODES = {
|
||||
if (container.kind === typeKinds.Enum) {
|
||||
html += ' = <span class="tok-number">' + fieldName + "</span>";
|
||||
} else {
|
||||
let fieldTypeExpr = container.fields[i];
|
||||
let fieldTypeExpr = container.field_types[i];
|
||||
if (container.kind !== typeKinds.Struct || !container.is_tuple) {
|
||||
html += ": ";
|
||||
}
|
||||
@@ -2869,6 +2869,12 @@ const NAV_MODES = {
|
||||
if (tsn) {
|
||||
html += "<span> (" + tsn + ")</span>";
|
||||
}
|
||||
if (container.kind === typeKinds.Struct && !container.is_tuple) {
|
||||
let defaultInitExpr = container.field_defaults[i];
|
||||
if (defaultInitExpr !== null) {
|
||||
html += " = " + exprName(defaultInitExpr, { wantHtml: true, wantLink: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html += ",</pre></div>";
|
||||
@@ -4057,10 +4063,11 @@ function addDeclToSearchResults(decl, declIndex, pkgNames, item, list, stack) {
|
||||
src: ty[2],
|
||||
privDecls: ty[3],
|
||||
pubDecls: ty[4],
|
||||
fields: ty[5],
|
||||
is_tuple: ty[6],
|
||||
line_number: ty[7],
|
||||
outer_decl: ty[8],
|
||||
field_types: ty[5],
|
||||
field_defaults: ty[6],
|
||||
is_tuple: ty[7],
|
||||
line_number: ty[8],
|
||||
outer_decl: ty[9],
|
||||
};
|
||||
case 10: // ComptimeExpr
|
||||
case 11: // ComptimeFloat
|
||||
|
||||
Reference in New Issue
Block a user