Skip to content

Commit d3b9357

Browse files
nknappjaylinski
authored andcommitted
refactor: rename i to startPartIndex
1 parent 99d162c commit d3b9357

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/handlebars/compiler/javascript-compiler.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,16 +534,22 @@ JavaScriptCompiler.prototype = {
534534
this.resolvePath('data', parts, 0, true, strict);
535535
},
536536

537-
resolvePath: function (type, parts, i, falsy, strict) {
537+
resolvePath: function (type, parts, startPartIndex, falsy, strict) {
538538
if (this.options.strict || this.options.assumeObjects) {
539539
this.push(
540-
strictLookup(this.options.strict && strict, this, parts, i, type)
540+
strictLookup(
541+
this.options.strict && strict,
542+
this,
543+
parts,
544+
startPartIndex,
545+
type
546+
)
541547
);
542548
return;
543549
}
544550

545551
let len = parts.length;
546-
for (; i < len; i++) {
552+
for (let i = startPartIndex; i < len; i++) {
547553
/* eslint-disable no-loop-func */
548554
this.replaceStack((current) => {
549555
let lookup = this.nameLookup(current, parts[i], type);
@@ -1155,14 +1161,14 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
11551161
);
11561162
};
11571163

1158-
function strictLookup(requireTerminal, compiler, parts, i, type) {
1164+
function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) {
11591165
let stack = compiler.popStack(),
11601166
len = parts.length;
11611167
if (requireTerminal) {
11621168
len--;
11631169
}
11641170

1165-
for (; i < len; i++) {
1171+
for (let i = startPartIndex; i < len; i++) {
11661172
stack = compiler.nameLookup(stack, parts[i], type);
11671173
}
11681174

@@ -1172,7 +1178,7 @@ function strictLookup(requireTerminal, compiler, parts, i, type) {
11721178
'(',
11731179
stack,
11741180
', ',
1175-
compiler.quotedString(parts[i]),
1181+
compiler.quotedString(parts[len]),
11761182
', ',
11771183
JSON.stringify(compiler.source.currentLocation),
11781184
' )',

0 commit comments

Comments
 (0)