diff options
author | kpdecker <kpdecker@gmail.com> | 2015-08-03 20:31:57 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2015-08-03 20:31:57 -0500 |
commit | 93b07605cddfe3736cf758e9f0e4fa0a92b0bb3d (patch) | |
tree | 42e50cee58ba99f250450dc3a714cfa543bd04bc /lib/handlebars/compiler/ast.js | |
parent | 85750f8d0a8a02bfb9c05eba90b635899c253f91 (diff) | |
download | handlebars.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.js | 4 |
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) { |