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.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index cb9b1ca..869a672 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -88,6 +88,7 @@ JavaScriptCompiler.prototype = {
var opcodes = environment.opcodes,
opcode,
+ firstLoc,
i,
l;
@@ -95,11 +96,12 @@ JavaScriptCompiler.prototype = {
opcode = opcodes[i];
this.source.currentLocation = opcode.loc;
+ firstLoc = firstLoc || opcode.loc;
this[opcode.opcode].apply(this, opcode.args);
}
// Flush any trailing content that might be pending.
- this.source.currentLocation = undefined;
+ this.source.currentLocation = firstLoc;
this.pushSource('');
/* istanbul ignore next */
@@ -135,6 +137,8 @@ JavaScriptCompiler.prototype = {
if (!asObject) {
ret.compiler = JSON.stringify(ret.compiler);
+
+ this.source.currentLocation = {firstLine: 1, firstColumn: 0};
ret = this.objectLiteral(ret);
if (options.srcName) {