Skip to content

Commit

Permalink
fix bug when generating raw code maps
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 7, 2017
1 parent 88d1d1f commit 874c68f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/SourceListMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SourceListMap.prototype.add = function(generatedCode, source, originalSource) {
if(typeof generatedCode === "string") {
if(source) {
this.children.push(new SourceNode(generatedCode, source, originalSource));
} else if(this.children.length > 0 && this.children[this.children.length - 1].addGeneratedCode) {
} else if(this.children.length > 0 && this.children[this.children.length - 1] instanceof CodeNode) {
this.children[this.children.length - 1].addGeneratedCode(generatedCode);
} else {
this.children.push(new CodeNode(generatedCode));
Expand Down
7 changes: 2 additions & 5 deletions test/mapGeneratedCode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
var should = require("should");
var fs = require("fs");
var path = require("path");
var SourceListMap = require("../").SourceListMap;

describe("mapGeneratedCode", function() {
Expand Down Expand Up @@ -51,9 +49,8 @@ describe("mapGeneratedCode", function() {
expectedPart,
"AAfA",
expectedPart,
"AACA",
expectedPart,
"AA/BA",
";;;;;;;;;;;",
"AAfA",
expectedPart
].join(";"));
result.source.should.be.eql(
Expand Down

0 comments on commit 874c68f

Please sign in to comment.