From 74f5ce54896eebec4050470874cc9a9ec4a50965 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 19 Aug 2024 09:11:20 +0200 Subject: [PATCH] docs: store parent type reference in documentation.js (#32215) --- utils/doclint/documentation.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js index 1c63421524..77b20ca769 100644 --- a/utils/doclint/documentation.js +++ b/utils/doclint/documentation.js @@ -353,6 +353,8 @@ class Member { this.clazz = null; /** @type {Member=} */ this.enclosingMethod = undefined; + /** @type {Member=} */ + this.parent = undefined; this.async = false; this.alias = name; this.overloadIndex = 0; @@ -372,10 +374,11 @@ class Member { this.args = new Map(); if (this.kind === 'method') this.enclosingMethod = this; - const indexType = type => { - type.deepProperties().forEach(p => { + const indexArg = (/** @type {Member} */ arg) => { + arg.type?.deepProperties().forEach(p => { p.enclosingMethod = this; - indexType(p.type); + p.parent = arg; + indexArg(p); }); } for (const arg of this.argsArray) { @@ -385,7 +388,7 @@ class Member { // @ts-ignore arg.type.properties.sort((p1, p2) => p1.name.localeCompare(p2.name)); } - indexType(arg.type); + indexArg(arg); } }