Merge pull request #420 from wagenet/version-check

Check version when evaluating templates.
This commit is contained in:
Yehuda Katz
2013-01-29 13:29:58 -08:00
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -1380,6 +1380,13 @@ Handlebars.JavaScriptCompiler = function() {};
// Perform a second pass over the output to merge content when possible
var source = this.mergeSource();
if (!this.isChild) {
source = "if (Handlebars.VERSION !== '"+Handlebars.VERSION+"') {\n"+
"throw 'Template was compiled with "+Handlebars.VERSION+", but runtime is '+Handlebars.VERSION;\n"+
"}\n"+
source;
}
if (asObject) {
params.push(source);
+7
View File
@@ -538,6 +538,13 @@ Handlebars.JavaScriptCompiler = function() {};
// Perform a second pass over the output to merge content when possible
var source = this.mergeSource();
if (!this.isChild) {
source = "if (Handlebars.VERSION !== '"+Handlebars.VERSION+"') {\n"+
"throw 'Template was compiled with "+Handlebars.VERSION+", but runtime is '+Handlebars.VERSION;\n"+
"}\n"+
source;
}
if (asObject) {
params.push(source);