summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2013-01-29 13:29:58 -0800
committerYehuda Katz <wycats@gmail.com>2013-01-29 13:29:58 -0800
commitedb6f11b42a535746f994e45f78b0458799ca704 (patch)
treeb4c482946379d8be88084844014bff2c0a1e719d /lib/handlebars/compiler/compiler.js
parenta3376e24b1a25f72cf86d1d999bd2ea93fa4dc39 (diff)
parentd7758fe1a9abdb0643e84a4534d352ab37e3094b (diff)
downloadhandlebars.js-edb6f11b42a535746f994e45f78b0458799ca704.zip
handlebars.js-edb6f11b42a535746f994e45f78b0458799ca704.tar.gz
handlebars.js-edb6f11b42a535746f994e45f78b0458799ca704.tar.bz2
Merge pull request #420 from wagenet/version-check
Check version when evaluating templates.
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 0d21739..b148bbb 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -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);