mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
autodoc: add support for non-generic function calls
This commit is contained in:
+12
-1
@@ -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 {};
|
||||
|
||||
Reference in New Issue
Block a user