Skip to content

Commit

Permalink
Provide default mapping for boilerplate code
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Nov 8, 2014
1 parent f5b7584 commit 0c0384a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/handlebars/compiler/javascript-compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ JavaScriptCompiler.prototype = {

var opcodes = environment.opcodes,
opcode,
firstLoc,
i,
l;

for (i = 0, l = opcodes.length; i < l; i++) {
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 */
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0c0384a

Please sign in to comment.