babel-generator
Advanced tools
Comparing version 6.4.3 to 6.4.5
@@ -129,2 +129,3 @@ /* @flow */ | ||
this.print(node.callee, node); | ||
if (node.loc) this.printAuxAfterComment(); | ||
@@ -131,0 +132,0 @@ this.push("("); |
@@ -89,3 +89,3 @@ "use strict"; | ||
this.map.mark(node, "start"); | ||
this.map.mark(node); | ||
@@ -103,3 +103,3 @@ this._print(node, parent); | ||
this._printStack.pop(); | ||
this.map.mark(node, "end"); | ||
if (parent) this.map.mark(parent); | ||
if (opts.after) opts.after(); | ||
@@ -183,2 +183,6 @@ | ||
if (opts.separator && parent.loc) { | ||
_this.printAuxAfterComment(); | ||
} | ||
if (opts.separator && i < len - 1) { | ||
@@ -185,0 +189,0 @@ _this.push(opts.separator); |
@@ -29,2 +29,3 @@ "use strict"; | ||
this.opts = opts; | ||
this.last = { generated: {}, original: {} }; | ||
@@ -60,3 +61,3 @@ if (opts.sourceMaps) { | ||
SourceMap.prototype.mark = function mark(node, type) { | ||
SourceMap.prototype.mark = function mark(node) { | ||
var loc = node.loc; | ||
@@ -77,9 +78,19 @@ if (!loc) return; // no location info | ||
var original = loc[type]; | ||
var original = loc.start; | ||
map.addMapping({ | ||
// Avoid emitting duplicates on either side. Duplicated | ||
// original values creates unnecesssarily large source maps | ||
// and increases compile time. Duplicates on the generated | ||
// side can lead to incorrect mappings. | ||
if (comparePosition(original, this.last.original) || comparePosition(generated, this.last.generated)) { | ||
return; | ||
} | ||
this.last = { | ||
source: this.opts.sourceFileName, | ||
generated: generated, | ||
original: original | ||
}); | ||
}; | ||
map.addMapping(this.last); | ||
}; | ||
@@ -91,2 +102,6 @@ | ||
exports["default"] = SourceMap; | ||
function comparePosition(a, b) { | ||
return a.line === b.line && a.column === b.column; | ||
} | ||
module.exports = exports["default"]; |
{ | ||
"name": "babel-generator", | ||
"version": "6.4.3", | ||
"version": "6.4.5", | ||
"description": "Turns an AST into code.", | ||
@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"babel-runtime": "^5.0.0", | ||
"babel-types": "^6.4.3", | ||
"babel-types": "^6.4.5", | ||
"detect-indent": "^3.0.1", | ||
@@ -27,4 +27,4 @@ "is-integer": "^1.0.4", | ||
"babel-helper-fixtures": "^6.3.13", | ||
"babylon": "^6.4.2" | ||
"babylon": "^6.4.5" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90318
21
2696
Updatedbabel-types@^6.4.5