summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index 7ad400c..526ddc1 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -1,4 +1,5 @@
import { COMPILER_REVISION, REVISION_CHANGES, log } from "../base";
+import Exception from "../exception";
function Literal(value) {
this.value = value;
@@ -104,6 +105,10 @@ JavaScriptCompiler.prototype = {
// Flush any trailing content that might be pending.
this.pushSource('');
+ if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
+ throw new Exception('Compile completed with content left on stack');
+ }
+
return this.createFunctionContext(asObject);
},
@@ -771,6 +776,9 @@ JavaScriptCompiler.prototype = {
return item.value;
} else {
if (!inline) {
+ if (!this.stackSlot) {
+ throw new Exception('Invalid stack pop');
+ }
this.stackSlot--;
}
return item;