summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-08-13 20:46:07 -0500
committerkpdecker <kpdecker@gmail.com>2014-08-13 20:46:42 -0500
commitc98613b711a70a82a960c20c00d8d92d5eed1024 (patch)
tree364862d90bc601284d35f5c19e8fed1abad7e4f4 /lib/handlebars/compiler/compiler.js
parent625b00e1dafccc8653bf4cb4dc3dac55f6b3b020 (diff)
downloadhandlebars.js-c98613b711a70a82a960c20c00d8d92d5eed1024.zip
handlebars.js-c98613b711a70a82a960c20c00d8d92d5eed1024.tar.gz
handlebars.js-c98613b711a70a82a960c20c00d8d92d5eed1024.tar.bz2
Implement recursive field lookup in compat mode
Provides the mustache behavior of recursive lookup without the use of depthed paths. Note that this does incur a fairly dramatic performance penalty for depthed queries.
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 48575d4..ffddec4 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -308,7 +308,7 @@ Compiler.prototype = {
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
this.opcode('pushContext');
} else {
- this.opcode('lookupOnContext', id.parts, id.falsy);
+ this.opcode('lookupOnContext', id.parts, id.falsy, id.isScoped);
}
},
@@ -424,6 +424,9 @@ export function precompile(input, options, env) {
if (!('data' in options)) {
options.data = true;
}
+ if (options.compat) {
+ options.useDepths = true;
+ }
var ast = env.parse(input);
var environment = new env.Compiler().compile(ast, options);
@@ -440,6 +443,9 @@ export function compile(input, options, env) {
if (!('data' in options)) {
options.data = true;
}
+ if (options.compat) {
+ options.useDepths = true;
+ }
var compiled;