summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorTyson Tate <tyson@tysontate.com>2012-09-19 16:03:46 -0700
committerTyson Tate <tyson@tysontate.com>2012-09-19 16:03:46 -0700
commit42120d1177cdb089c414e2b51ce441f95c53faad (patch)
tree8f73852679973c77b81fb9cef54c8d62da49e879 /lib/handlebars/compiler/compiler.js
parentb5074a88ec17917309f5482de004076f3f676ad1 (diff)
downloadhandlebars.js-42120d1177cdb089c414e2b51ce441f95c53faad.zip
handlebars.js-42120d1177cdb089c414e2b51ce441f95c53faad.tar.gz
handlebars.js-42120d1177cdb089c414e2b51ce441f95c53faad.tar.bz2
Bind functions to the context properly.
The regression was introduced in 1.0.rc.1. This fixes issue #317.
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 108d055..7578dd2 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -642,7 +642,7 @@ Handlebars.JavaScriptCompiler = function() {};
this.context.aliases.functionType = '"function"';
this.replaceStack(function(current) {
- return "typeof " + current + " === functionType ? " + current + "() : " + current;
+ return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current;
});
},
@@ -787,7 +787,7 @@ Handlebars.JavaScriptCompiler = function() {};
var nextStack = this.nextStack();
this.source.push('if (foundHelper) { ' + nextStack + ' = foundHelper.call(' + helper.callParams + '); }');
- this.source.push('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '() : ' + nextStack + '; }');
+ this.source.push('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.apply(depth0) : ' + nextStack + '; }');
},
// [invokePartial]