Improved precompile template version check

This check reduces duplicated code as well as also failing if the
template was precompiled on a version before the check was added.
This commit is contained in:
Peter Wagenet
2013-01-30 22:44:30 -08:00
parent edb6f11b42
commit 6fe7f17c89
4 changed files with 23 additions and 14 deletions
+1 -4
View File
@@ -539,10 +539,7 @@ Handlebars.JavaScriptCompiler = function() {};
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;
source = "this.compiledVersion = '"+Handlebars.VERSION+"';\n"+source;
}
if (asObject) {