summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/ast.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-08-03 20:31:57 -0500
committerkpdecker <kpdecker@gmail.com>2015-08-03 20:31:57 -0500
commit93b07605cddfe3736cf758e9f0e4fa0a92b0bb3d (patch)
tree42e50cee58ba99f250450dc3a714cfa543bd04bc /lib/handlebars/compiler/ast.js
parent85750f8d0a8a02bfb9c05eba90b635899c253f91 (diff)
downloadhandlebars.js-93b07605cddfe3736cf758e9f0e4fa0a92b0bb3d.zip
handlebars.js-93b07605cddfe3736cf758e9f0e4fa0a92b0bb3d.tar.gz
handlebars.js-93b07605cddfe3736cf758e9f0e4fa0a92b0bb3d.tar.bz2
Bulletproof AST.helpers.helperExpression
Avoid undefined values and potential false positives from other type values such as partials. Fixes #1055
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r--lib/handlebars/compiler/ast.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js
index 08b127f..599dab8 100644
--- a/lib/handlebars/compiler/ast.js
+++ b/lib/handlebars/compiler/ast.js
@@ -131,7 +131,9 @@ let AST = {
// * it is an eligible helper, and
// * it has at least one parameter or hash segment
helperExpression: function(node) {
- return !!(node.type === 'SubExpression' || node.params.length || node.hash);
+ return (node.type === 'SubExpression')
+ || ((node.type === 'MustacheStatement' || node.type === 'BlockStatement')
+ && !!((node.params && node.params.length) || node.hash));
},
scopedId: function(path) {