authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-04-18 17:36:36+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:11-07:00
logae4b5c29b27990cdb5b0b517965bd6a21294d35a
treeda7feb0f8f5cc787ffb9a43920e6841b3be8c113
parentcc71003cfcd8af8e037dd127ea627113fbc17103

autodoc: fix final js type error


1 files changed, 59 insertions(+), 59 deletions(-)

lib/docs/main.js+59-59
......@@ -268,7 +268,7 @@ var zigAnalysis;
268268 let domTableFnErrors =/** @type HTMLElement */(document.getElementById("tableFnErrors"));
269269 let domFnErrorsAnyError = /** @type HTMLElement */(document.getElementById("fnErrorsAnyError"));
270270 let domFnExamples = /** @type HTMLElement */(document.getElementById("fnExamples"));
271 let domListFnExamples = /** @type HTMLElement */(document.getElementById("listFnExamples"));
271 // let domListFnExamples = /** @type HTMLElement */(document.getElementById("listFnExamples"));
272272 let domFnNoExamples = /** @type HTMLElement */(document.getElementById("fnNoExamples"));
273273 let domDeclNoRef = /** @type HTMLElement */(document.getElementById("declNoRef"));
274274 let domSearch = /** @type HTMLInputElement */(document.getElementById("search"));
......@@ -277,7 +277,7 @@ var zigAnalysis;
277277 let domListSearchResults = /** @type HTMLElement */(document.getElementById("listSearchResults"));
278278 let domSectSearchNoResults = /** @type HTMLElement */(document.getElementById("sectSearchNoResults"));
279279 let domSectInfo = /** @type HTMLElement */(document.getElementById("sectInfo"));
280 let domTdTarget = /** @type HTMLElement */(document.getElementById("tdTarget"));
280 // let domTdTarget = /** @type HTMLElement */(document.getElementById("tdTarget"));
281281 let domPrivDeclsBox = /** @type HTMLInputElement */(document.getElementById("privDeclsBox"));
282282 let domTdZigVer = /** @type HTMLElement */(document.getElementById("tdZigVer"));
283283 let domHdrName = /** @type HTMLElement */(document.getElementById("hdrName"));
......@@ -447,21 +447,21 @@ var zigAnalysis;
447447 return typeKind === typeKinds.ErrorSet || typeKindIsContainer(typeKind);
448448 }
449449
450 /**
451 * @param {WalkResult[]} path
452 * @return {WalkResult | null}
453 */
454 function findCteInRefPath(path) {
455 for (let i = path.length - 1; i >= 0; i -= 1) {
456 const ref = path[i];
457 if ("string" in ref) continue;
458 if ("comptimeExpr" in ref) return ref;
459 if ("refPath" in ref) return findCteInRefPath(ref.refPath);
460 return null;
461 }
450 // /**
451 // * @param {WalkResult[]} path
452 // * @return {WalkResult | null}
453 // */
454 // function findCteInRefPath(path) {
455 // for (let i = path.length - 1; i >= 0; i -= 1) {
456 // const ref = path[i];
457 // if ("string" in ref) continue;
458 // if ("comptimeExpr" in ref) return ref;
459 // if ("refPath" in ref) return findCteInRefPath(ref.refPath);
460 // return null;
461 // }
462462
463 return null;
464 }
463 // return null;
464 // }
465465
466466 /**
467467 * @param {WalkResult} value
......@@ -960,22 +960,22 @@ var zigAnalysis;
960960 return navLink(curNav.pkgNames, curNav.declNames.concat([childName]));
961961 }
962962
963 /** @param {Call} callObj */
964 function navLinkCall(callObj) {
965 let declNamesCopy = curNav.declNames.concat([]);
966 let callName = /** @type {string} */(declNamesCopy.pop());
963 // /** @param {Call} callObj */
964 // function navLinkCall(callObj) {
965 // let declNamesCopy = curNav.declNames.concat([]);
966 // let callName = /** @type {string} */(declNamesCopy.pop());
967967
968 callName += '(';
969 for (let arg_i = 0; arg_i < callObj.args.length; arg_i += 1) {
970 if (arg_i !== 0) callName += ',';
971 let argObj = callObj.args[arg_i];
972 callName += getValueText(argObj, argObj, false, false);
973 }
974 callName += ')';
968 // callName += '(';
969 // for (let arg_i = 0; arg_i < callObj.args.length; arg_i += 1) {
970 // if (arg_i !== 0) callName += ',';
971 // let argObj = callObj.args[arg_i];
972 // callName += getValueText(argObj, argObj, false, false);
973 // }
974 // callName += ')';
975975
976 declNamesCopy.push(callName);
977 return navLink(curNav.pkgNames, declNamesCopy);
978 }
976 // declNamesCopy.push(callName);
977 // return navLink(curNav.pkgNames, declNamesCopy);
978 // }
979979
980980 /**
981981 * @param {any} dlDom
......@@ -1135,35 +1135,35 @@ var zigAnalysis;
11351135 // return html;
11361136 // }
11371137
1138 /**
1139 * @param {WalkResult} typeRef
1140 * @param {any} value
1141 * @param {boolean} wantHtml
1142 * @param {boolean} wantLink
1143 */
1144 function getValueText(typeRef, value, wantHtml, wantLink) {
1145 let resolvedTypeRef = resolveValue(typeRef);
1146 if ("comptimeExpr" in resolvedTypeRef) {
1147 return "[ComptimeExpr]";
1148 }
1149 console.assert("type" in resolvedTypeRef);
1150 let typeObj = zigAnalysis.types[typeRef.type];
1151 switch (typeObj.kind) {
1152 case typeKinds.Type:
1153 return typeValueName(value, wantHtml, wantLink);
1154 case typeKinds.Fn:
1155 let fnObj = zigAnalysis.fns[value];
1156 return typeName(fnObj, wantHtml, wantLink);
1157 case typeKinds.Int:
1158 if (wantHtml) {
1159 return '<span class="tok-number">' + value + '</span>';
1160 } else {
1161 return value + "";
1162 }
1163 default:
1164 console.trace("TODO implement getValueText for this type:", zigAnalysis.typeKinds[typeObj.kind]);
1165 }
1166 }
1138 // /**
1139 // * @param {WalkResult} typeRef
1140 // * @param {any} value
1141 // * @param {boolean} wantHtml
1142 // * @param {boolean} wantLink
1143 // */
1144 // function getValueText(typeRef, value, wantHtml, wantLink) {
1145 // let resolvedTypeRef = resolveValue(typeRef);
1146 // if ("comptimeExpr" in resolvedTypeRef) {
1147 // return "[ComptimeExpr]";
1148 // }
1149 // console.assert("type" in resolvedTypeRef);
1150 // let typeObj = zigAnalysis.types[typeRef.type];
1151 // switch (typeObj.kind) {
1152 // case typeKinds.Type:
1153 // return typeValueName(value, wantHtml, wantLink);
1154 // case typeKinds.Fn:
1155 // let fnObj = zigAnalysis.fns[value];
1156 // return typeName(fnObj, wantHtml, wantLink);
1157 // case typeKinds.Int:
1158 // if (wantHtml) {
1159 // return '<span class="tok-number">' + value + '</span>';
1160 // } else {
1161 // return value + "";
1162 // }
1163 // default:
1164 // console.trace("TODO implement getValueText for this type:", zigAnalysis.typeKinds[typeObj.kind]);
1165 // }
1166 // }
11671167
11681168 /**
11691169 * @param {Type} typeObj,