Skip to content

Commit 6abdd10

Browse files
committed
refactor: rename i to startPartIndex
1 parent 520e1d5 commit 6abdd10

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
@@ -535,16 +535,22 @@ JavaScriptCompiler.prototype = {
535535
this.resolvePath('data', parts, 0, true, strict);
536536
},
537537

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

546552
let len = parts.length;
547-
for (; i < len; i++) {
553+
for (let i = startPartIndex; i < len; i++) {
548554
/* eslint-disable no-loop-func */
549555
this.replaceStack(current => {
550556
let lookup = this.nameLookup(current, parts[i], type);
@@ -1263,14 +1269,14 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
12631269
);
12641270
};
12651271

1266-
function strictLookup(requireTerminal, compiler, parts, i, type) {
1272+
function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) {
12671273
let stack = compiler.popStack(),
12681274
len = parts.length;
12691275
if (requireTerminal) {
12701276
len--;
12711277
}
12721278

1273-
for (; i < len; i++) {
1279+
for (let i = startPartIndex; i < len; i++) {
12741280
stack = compiler.nameLookup(stack, parts[i], type);
12751281
}
12761282

@@ -1280,7 +1286,7 @@ function strictLookup(requireTerminal, compiler, parts, i, type) {
12801286
'(',
12811287
stack,
12821288
', ',
1283-
compiler.quotedString(parts[i]),
1289+
compiler.quotedString(parts[len]),
12841290
', ',
12851291
JSON.stringify(compiler.source.currentLocation),
12861292
' )'

0 commit comments

Comments
 (0)