babel-generator
Advanced tools
Comparing version 6.2.0 to 6.2.3
@@ -113,3 +113,5 @@ "use strict"; | ||
this.newline(true); | ||
//if (this.format.compact) this._removeLast(";"); | ||
if (this.format.compact && !this._lastPrintedIsEmptyStatement) { | ||
this._removeLast(";"); | ||
} | ||
this.push("}"); | ||
@@ -116,0 +118,0 @@ }; |
@@ -173,2 +173,3 @@ /* @flow */ | ||
function EmptyStatement() { | ||
this._lastPrintedIsEmptyStatement = true; | ||
this.semicolon(); | ||
@@ -184,3 +185,5 @@ } | ||
this.print(node.left, node); | ||
this.push(" = "); | ||
this.space(); | ||
this.push("="); | ||
this.space(); | ||
this.print(node.right, node); | ||
@@ -201,3 +204,2 @@ } | ||
var spaces = !this.format.compact || node.operator === "in" || node.operator === "instanceof"; | ||
spaces = true; // todo: https://github.com/babel/babel/issues/1835 | ||
if (spaces) this.push(" "); | ||
@@ -210,3 +212,5 @@ | ||
// http://javascript.spec.whatwg.org/#comment-syntax | ||
spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" }); | ||
spaces = node.operator === "<" && t.isUnaryExpression(node.right, { prefix: true, operator: "!" }) && t.isUnaryExpression(node.right.argument, { prefix: true, operator: "--" }) || | ||
// Need spaces for operators of the same kind to avoid: `a+++b` | ||
t.isUnaryExpression(node.right, { prefix: true, operator: node.operator }) || t.isUpdateExpression(node.right, { prefix: true, operator: node.operator + node.operator }); | ||
} | ||
@@ -213,0 +217,0 @@ |
@@ -53,2 +53,4 @@ "use strict"; | ||
this._lastPrintedIsEmptyStatement = false; | ||
if (parent && parent._compact) { | ||
@@ -192,8 +194,8 @@ node._compact = true; | ||
var node = parent.body; | ||
if (t.isEmptyStatement(node)) { | ||
this.semicolon(); | ||
} else { | ||
this.push(" "); | ||
this.print(node, parent); | ||
if (!t.isEmptyStatement(node)) { | ||
this.space(); | ||
} | ||
this.print(node, parent); | ||
}; | ||
@@ -200,0 +202,0 @@ |
{ | ||
"name": "babel-generator", | ||
"version": "6.2.0", | ||
"version": "6.2.3", | ||
"description": "Turns an AST into code.", | ||
@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"babel-runtime": "^5.0.0", | ||
"babel-types": "^6.2.0", | ||
"babel-types": "^6.2.3", | ||
"detect-indent": "^3.0.1", | ||
@@ -19,0 +19,0 @@ "is-integer": "^1.0.4", |
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
83892
2580
Updatedbabel-types@^6.2.3