Skip to content

Commit

Permalink
Formatting fixes & minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Nov 28, 2022
1 parent f4db252 commit 98875ae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/processors/jsdoc/lib/ui5/plugin.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ function resolveObjectPatternChain (valueNode, keyNode, keyChain) {
}

return chainSequence;
};
}

/**
* Tries to resolve an ENUM, regardless where it is defined and being destructured.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(".");
Expand All @@ -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;
Expand Down Expand Up @@ -899,7 +901,7 @@ function resolveFullyQuantifiedName(node) {
return nearestScope.functionExpressionScope
? nearestScope.childScopes[0]
: nearestScope;
};
}

function isCompileTimeConstant(node) {
return node && node.type === Syntax.Literal;
Expand Down

0 comments on commit 98875ae

Please sign in to comment.