Skip to content

Commit

Permalink
simplify local variable resolution step
Browse files Browse the repository at this point in the history
  • Loading branch information
Churro committed May 10, 2023
1 parent f6fd707 commit 9a5760e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/modules/manager/gradle/parser/common.ts
Expand Up @@ -117,12 +117,9 @@ export function findVariable(
variables: PackageVariables = ctx.globalVars
): VariableData | undefined {
if (ctx.tmpNestingDepth.length) {
let nestingPrefixes = ctx.tmpNestingDepth.length;
while (nestingPrefixes > 0) {
const prefix = ctx.tmpNestingDepth
.slice(0, nestingPrefixes--)
.map((token) => token.value)
.join('.');
const prefixParts = ctx.tmpNestingDepth.map((token) => token.value);
for (let idx = ctx.tmpNestingDepth.length; idx > 0; idx -= 1) {
const prefix = prefixParts.slice(0, idx).join('.');
const identifier = `${prefix}.${name}`;

if (variables[identifier]) {
Expand Down

0 comments on commit 9a5760e

Please sign in to comment.