diff --git a/lib/std/special/docs/index.html b/lib/std/special/docs/index.html index 068ad069d8..e7a57137e5 100644 --- a/lib/std/special/docs/index.html +++ b/lib/std/special/docs/index.html @@ -311,10 +311,8 @@
' + escapeHtml(field.name) + ": " + + typeIndexName(field.type, true, true) + ','; var docs = zigAnalysis.astNodes[field.src].docs; if (docs != null) { - tdDesc.innerHTML = shortDescMarkdown(docs); - } else { - tdDesc.textContent = ""; + html += markdown(docs); } + divDom.innerHTML = html; } domSectFields.classList.remove("hidden"); } @@ -846,6 +841,10 @@ typeKindErrUnionId = i; } else if (zigAnalysis.typeKinds[i] === "Struct") { typeKindStructId = i; + } else if (zigAnalysis.typeKinds[i] === "Union") { + typeKindUnionId = i; + } else if (zigAnalysis.typeKinds[i] === "Enum") { + typeKindEnumId = i; } } if (typeKindTypeId == null) { @@ -881,6 +880,12 @@ if (typeKindStructId == null) { throw new Error("No type kind 'Struct' found"); } + if (typeKindUnionId == null) { + throw new Error("No type kind 'Union' found"); + } + if (typeKindEnumId == null) { + throw new Error("No type kind 'Enum' found"); + } } function findTypeTypeId() { @@ -970,6 +975,13 @@ return list; } + function declCanRepresentTypeKind(typeKind) { + return typeKind === typeKindErrSetId || + typeKind === typeKindStructId || + typeKind === typeKindUnionId || + typeKind === typeKindEnumId; + } + function computeCanonDeclPaths() { var list = new Array(zigAnalysis.decls.length); canonTypeDecls = new Array(zigAnalysis.types.length); @@ -991,7 +1003,9 @@ if (list[mainDeclIndex] != null) continue; var decl = zigAnalysis.decls[mainDeclIndex]; - if (decl.type === typeTypeId) { + if (decl.type === typeTypeId && + declCanRepresentTypeKind(zigAnalysis.types[decl.value].kind)) + { canonTypeDecls[decl.value] = mainDeclIndex; } var declNames = item.declNames.concat([decl.name]); diff --git a/src/dump_analysis.cpp b/src/dump_analysis.cpp index 168d86a21f..c124e6d86b 100644 --- a/src/dump_analysis.cpp +++ b/src/dump_analysis.cpp @@ -811,7 +811,7 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) { jw_end_array(jw); } - { + if (ty->data.structure.src_field_count != 0) { jw_object_field(jw, "fields"); jw_begin_array(jw);