authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2023-05-24 18:32:00+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-05-24 18:32:00+02:00
logc9dffc842e5b9875066f012daaa0888d073ba584
treeaf10c60ee7984c26f319616a14e5ed5b104d2ad2
parent7cb2e653a20698b4b8050705bcb72afeea9df63b
parent94a7d5b8a56fd70fc7a3afe9c010a2b9cdb07b14
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15810 from der-teufel-programming/autodoc-quickfixes

autodoc: Links to private decls now lead to source files

1 files changed, 29 insertions(+), 4 deletions(-)

lib/docs/main.js+29-4
...@@ -572,7 +572,7 @@ const NAV_MODES = {...@@ -572,7 +572,7 @@ const NAV_MODES = {
572 for (let i = 0; i < curNav.declNames.length; i += 1) {572 for (let i = 0; i < curNav.declNames.length; i += 1) {
573 let childDecl = findSubDecl(currentType, curNav.declNames[i]);573 let childDecl = findSubDecl(currentType, curNav.declNames[i]);
574 window.last_decl = childDecl;574 window.last_decl = childDecl;
575 if (childDecl == null) {575 if (childDecl == null || childDecl.is_private === true) {
576 return render404();576 return render404();
577 }577 }
578 lastDecl = childDecl;578 lastDecl = childDecl;
...@@ -995,9 +995,15 @@ const NAV_MODES = {...@@ -995,9 +995,15 @@ const NAV_MODES = {
995 return navLink(curNav.modNames, declPath);995 return navLink(curNav.modNames, declPath);
996 }996 }
997997
998 if (findSubDecl(curDecl, declName) != null) {998 const subDecl = findSubDecl(curDecl, declName);
999 const declPath = curNav.declNames.slice(0, i).concat([declName]);999
1000 return navLink(curNav.modNames, declPath);1000 if (subDecl != null) {
1001 if (subDecl.is_private === true) {
1002 return sourceFileLink(subDecl);
1003 } else {
1004 const declPath = curNav.declNames.slice(0, i).concat([declName]);
1005 return navLink(curNav.modNames, declPath);
1006 }
1001 }1007 }
1002 }1008 }
10031009
...@@ -3318,6 +3324,25 @@ const NAV_MODES = {...@@ -3318,6 +3324,25 @@ const NAV_MODES = {
3318 }3324 }
3319 }3325 }
33203326
3327 if (parentType.privDecls) {
3328 for (let i = 0; i < parentType.privDecls.length; i += 1) {
3329 let declIndex = parentType.privDecls[i];
3330 let childDecl = getDecl(declIndex);
3331 if (childDecl.name === childName) {
3332 childDecl.find_subdecl_idx = declIndex;
3333 childDecl.is_private = true;
3334 return childDecl;
3335 } else if (childDecl.is_uns) {
3336 let declValue = resolveValue(childDecl.value);
3337 if (!("type" in declValue.expr)) continue;
3338 let uns_container = getType(declValue.expr.type);
3339 let uns_res = findSubDecl(uns_container, childName);
3340 uns_res.is_private = true;
3341 if (uns_res !== null) return uns_res;
3342 }
3343 }
3344 }
3345
3321 return null;3346 return null;
3322 }3347 }
33233348