{{#x-foo}}yeaaaah{{/x-foo}
If stringParams is enabled and x-foo isn't in the helpers hash, I'd like to be able to catch this in blockHelperMissing, but the problem is that the first parameter of blockHelperMissing ends up getting the undefined result of currentContext['x-foo'], which completely prevents me from doing something special with this value.
Context: this is important for Ember to be able to hook into for the purposes of detecting container-registered helpers and components. Without fixing this directly in handlebars, I'm forced to do this following terrible hax:
function stringifyLastBlockHelperMissingInvocation(source) {
var helperInvocation = source[source.length - 1],
helperName = (/helpers\.(.*)\)/.exec(helperInvocation) || /helpers\['(.*)'/.exec(helperInvocation))[1],
matches = /(.*blockHelperMissing\.call\(.*)(stack[0-9]+)(,.*)/.exec(helperInvocation);
source[source.length - 1] = matches[1] + "'" + helperName + "'" + matches[3];
}
var originalBlockValue = Ember.Handlebars.JavaScriptCompiler.prototype.blockValue;
Ember.Handlebars.JavaScriptCompiler.prototype.blockValue = function() {
originalBlockValue.apply(this, arguments);
stringifyLastBlockHelperMissingInvocation(this.source);
};
var originalAmbiguousBlockValue = Ember.Handlebars.JavaScriptCompiler.prototype.ambiguousBlockValue;
Ember.Handlebars.JavaScriptCompiler.prototype.ambiguousBlockValue = function() {
originalAmbiguousBlockValue.apply(this, arguments);
stringifyLastBlockHelperMissingInvocation(this.source);
};
If
stringParamsis enabled andx-fooisn't in thehelpershash, I'd like to be able to catch this inblockHelperMissing, but the problem is that the first parameter ofblockHelperMissingends up getting theundefinedresult ofcurrentContext['x-foo'], which completely prevents me from doing something special with this value.Context: this is important for Ember to be able to hook into for the purposes of detecting container-registered helpers and components. Without fixing this directly in handlebars, I'm forced to do this following terrible hax: