Skip to content

Commit b16b6bc

Browse files
committed
[INTERNAL] JSDoc: push the deprecation of namespaces down to the contained APIs
Change-Id: I67f019d4f966b1dcb15c869e437e6feffbb0c574
1 parent 7db8d2b commit b16b6bc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/jsdoc/ui5/template/publish.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ function publish(symbolSet) {
231231

232232
// now resolve relationships
233233
const aRootNamespaces = createNamespaceTree(allSymbols);
234+
pushDownDeprecations(allSymbols);
234235
createInheritanceTree(allSymbols);
235236
collectMembers(allSymbols);
236237
mergeEventDocumentation(allSymbols);
@@ -374,6 +375,33 @@ function makeNamespace(memberof) {
374375
]);
375376
}
376377

378+
function pushDownDeprecations() {
379+
380+
function pushDown(oSymbol, sInheritedDeprecation) {
381+
if (oSymbol == null || !isFirstClassSymbol(oSymbol)) {
382+
return;
383+
}
384+
const sOwnDeprecation = oSymbol.deprecated;
385+
if (sOwnDeprecation == null && sInheritedDeprecation != null) {
386+
oSymbol.deprecated = sInheritedDeprecation;
387+
info(`mark ${oSymbol.longname} as deprecated (${sInheritedDeprecation})`);
388+
} else if (sOwnDeprecation != null) {
389+
const info = extractSince(sOwnDeprecation);
390+
const sinceBecause = info.since ? `As of version ${info.since}, because`: `Because`;
391+
sInheritedDeprecation = `${sinceBecause} it is part of the deprecated package ${oSymbol.longname}`;
392+
}
393+
oSymbol.__ui5.children?.forEach((oChild) => pushDown(oChild, sInheritedDeprecation));
394+
}
395+
396+
// w/o a library name we can't start with the library namespace
397+
if (!templateConf.uilib) {
398+
return;
399+
}
400+
401+
// start the push down at the library namespace to ensure locality
402+
pushDown(lookup(templateConf.uilib));
403+
}
404+
377405
//---- inheritance hierarchy ----------------------------------------------------------------------------
378406

379407
/*

0 commit comments

Comments
 (0)