From 98875ae8c72a359207d9fd7c61904b478eb4a1bb Mon Sep 17 00:00:00 2001 From: Yavor Ivanov Date: Mon, 28 Nov 2022 09:47:21 +0200 Subject: [PATCH] Formatting fixes & minor refactoring --- lib/processors/jsdoc/lib/ui5/plugin.cjs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/processors/jsdoc/lib/ui5/plugin.cjs b/lib/processors/jsdoc/lib/ui5/plugin.cjs index ce6d5a8c8..fc19d1ad6 100644 --- a/lib/processors/jsdoc/lib/ui5/plugin.cjs +++ b/lib/processors/jsdoc/lib/ui5/plugin.cjs @@ -700,7 +700,7 @@ function resolveObjectPatternChain (valueNode, keyNode, keyChain) { } return chainSequence; -}; +} /** * Tries to resolve an ENUM, regardless where it is defined and being destructured. @@ -795,7 +795,7 @@ function checkVarRenaming(variable) { ({ original, renamed }) => renamed === variable.name || original === variable.name ); -}; +} /** * Builds the fully quantified name when there's a destructuring of a variable @@ -835,11 +835,11 @@ function resolveFullyQuantifiedName(node) { // with currentModule.localNames[].path i.e. in "chained" destructuring, where // the variable is not within localNames registry if ( potentialRenaming.renamed === renamedChunks[0] ) { // Checks for direct renaming - renamedChunks.splice(0, 1, potentialRenaming.original); + renamedChunks[0] = potentialRenaming.original; } // Considers the 'path' if it differs from the original name i.e. there's some namespace before it if ( potentialRenaming.original === renamedChunks[0] && potentialRenaming.path !== potentialRenaming.original ) { - renamedChunks.splice(0, 1, potentialRenaming.path); + renamedChunks[0] = potentialRenaming.path; } originalName = renamedChunks.join("."); @@ -849,7 +849,9 @@ function resolveFullyQuantifiedName(node) { // The same case as variable.defs- we're not able to determine the correct chain in case of multiple writeExpr if (writeExpr.length !== 1) { - break; + // writeExpr.length === 0 means an function argument and then we need + // just to return the already build originalName + return writeExpr.length === 0 ? originalName : ""; } const writeExprNode = writeExpr[0].writeExpr; @@ -899,7 +901,7 @@ function resolveFullyQuantifiedName(node) { return nearestScope.functionExpressionScope ? nearestScope.childScopes[0] : nearestScope; -}; +} function isCompileTimeConstant(node) { return node && node.type === Syntax.Literal;