summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-11-08 17:04:12 -0600
committerkpdecker <kpdecker@gmail.com>2014-11-08 17:50:01 -0600
commit1429587dd433dbab18cead0b17d1b024ec5f1be3 (patch)
tree1a05e45879f2291992855a4c0698a7725cefb462 /lib/handlebars/compiler/javascript-compiler.js
parent0dbeeb450336522816335ecd188951f6079ff0d3 (diff)
downloadhandlebars.js-1429587dd433dbab18cead0b17d1b024ec5f1be3.zip
handlebars.js-1429587dd433dbab18cead0b17d1b024ec5f1be3.tar.gz
handlebars.js-1429587dd433dbab18cead0b17d1b024ec5f1be3.tar.bz2
Provide default mapping for boilerplate code
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) {