autodoc: add support for non-generic function calls

This commit is contained in:
Loris Cro
2022-03-03 19:15:04 +01:00
committed by Andrew Kelley
parent 028c8a3c91
commit 195231b212
2 changed files with 58 additions and 21 deletions
+12 -1
View File
@@ -82,7 +82,7 @@
// map of decl index to list of non-generic fn indexes
// var nodesToFnsMap = indexNodesToFns();
// map of decl index to list of comptime fn calls
var nodesToCallsMap = indexNodesToCalls();
// var nodesToCallsMap = indexNodesToCalls();
domSearch.addEventListener('keydown', onSearchKeyDown, false);
window.addEventListener('hashchange', onHashChange, false);
@@ -193,6 +193,17 @@
return resolveTypeRefToTypeId(cte.typeRef);
}
if ("call" in decl.value) {
const fn_call = zigAnalysis.calls[decl.value.call];
console.assert("declPath" in fn_call.func);
const fn_decl = zigAnalysis.decls[fn_call.func.declPath[0]];
const fn_decl_value = resolveValue(fn_decl.value);
console.assert("type" in fn_decl_value); //TODO handle comptimeExpr
const fn_type = zigAnalysis.types[fn_decl_value.type];
console.assert(fn_type.kind === typeKinds.Fn);
return resolveTypeRefToTypeId(fn_type.ret);
}
console.log("TODO: handle in `typeOfDecl` more cases: ", decl);
console.assert(false);
throw {};