summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/handlebars/compiler/compiler.js10
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js12
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index c1ef47e..59a425f 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -217,13 +217,16 @@ Compiler.prototype = {
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
+ path.strict = true;
this.accept(path);
this.opcode('invokeAmbiguous', name, isBlock);
},
simpleSexpr: function(sexpr) {
- this.accept(sexpr.path);
+ let path = sexpr.path;
+ path.strict = true;
+ this.accept(path);
this.opcode('resolvePossibleLambda');
},
@@ -237,6 +240,7 @@ Compiler.prototype = {
} else if (this.options.knownHelpersOnly) {
throw new Exception('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr);
} else {
+ path.strict = true;
path.falsy = true;
this.accept(path);
@@ -259,9 +263,9 @@ Compiler.prototype = {
this.opcode('pushContext');
} else if (path.data) {
this.options.data = true;
- this.opcode('lookupData', path.depth, path.parts);
+ this.opcode('lookupData', path.depth, path.parts, path.strict);
} else {
- this.opcode('lookupOnContext', path.parts, path.falsy, scoped);
+ this.opcode('lookupOnContext', path.parts, path.falsy, path.strict, scoped);
}
},
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index d39ecb2..28f27fd 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -390,7 +390,7 @@ JavaScriptCompiler.prototype = {
//
// Looks up the value of `name` on the current context and pushes
// it onto the stack.
- lookupOnContext: function(parts, falsy, scoped) {
+ lookupOnContext: function(parts, falsy, strict, scoped) {
let i = 0;
if (!scoped && this.options.compat && !this.lastContext) {
@@ -401,7 +401,7 @@ JavaScriptCompiler.prototype = {
this.pushContext();
}
- this.resolvePath('context', parts, i, falsy);
+ this.resolvePath('context', parts, i, falsy, strict);
},
// [lookupBlockParam]
@@ -424,19 +424,19 @@ JavaScriptCompiler.prototype = {
// On stack, after: data, ...
//
// Push the data lookup operator
- lookupData: function(depth, parts) {
+ lookupData: function(depth, parts, strict) {
if (!depth) {
this.pushStackLiteral('data');
} else {
this.pushStackLiteral('this.data(data, ' + depth + ')');
}
- this.resolvePath('data', parts, 0, true);
+ this.resolvePath('data', parts, 0, true, strict);
},
- resolvePath: function(type, parts, i, falsy) {
+ resolvePath: function(type, parts, i, falsy, strict) {
if (this.options.strict || this.options.assumeObjects) {
- this.push(strictLookup(this.options.strict, this, parts, type));
+ this.push(strictLookup(this.options.strict && strict, this, parts, type));
return;
}