diff options
author | kpdecker <kpdecker@gmail.com> | 2015-09-01 01:05:00 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2015-09-01 01:05:00 -0500 |
commit | b63d74a7b3be48e388d47752676e26136ad7ff10 (patch) | |
tree | d80caf75816c9b6fb024bfd3ba550b2dfc4b13b8 /lib/handlebars/compiler/compiler.js | |
parent | e7a64f018ca541a7e0ac8ab2108ed86820bb47b1 (diff) | |
download | handlebars.js-b63d74a7b3be48e388d47752676e26136ad7ff10.zip handlebars.js-b63d74a7b3be48e388d47752676e26136ad7ff10.tar.gz handlebars.js-b63d74a7b3be48e388d47752676e26136ad7ff10.tar.bz2 |
Add explicitPartialContext compiler flag
Fixes #1032
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 64af5da..987d0d4 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -177,7 +177,11 @@ Compiler.prototype = { if (params.length > 1) { throw new Exception('Unsupported number of partial arguments: ' + params.length, partial); } else if (!params.length) { - params.push({type: 'PathExpression', parts: [], depth: 0}); + if (this.options.explicitPartialContext) { + this.opcode('pushLiteral', 'undefined'); + } else { + params.push({type: 'PathExpression', parts: [], depth: 0}); + } } let partialName = partial.name.original, |