diff --git a/src/fast-path.js b/src/fast-path.js index ea18f8284dfd..8bbc490fe12c 100644 --- a/src/fast-path.js +++ b/src/fast-path.js @@ -424,6 +424,8 @@ FPp.needsParens = function(assumeExpressionContext) { return false; } else if (parent.type === "ExpressionStatement") { return node.left.type === "ObjectPattern"; + } else if (parent.type === "AssignmentExpression") { + return false; } return true; diff --git a/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap b/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..cc53cafe36d0 --- /dev/null +++ b/tests/assignment_expression/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`assignment_expression.js 1`] = ` +"this.size = this._origin = this._capacity = 0; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +this.size = this._origin = this._capacity = 0; +" +`; diff --git a/tests/assignment_expression/assignment_expression.js b/tests/assignment_expression/assignment_expression.js new file mode 100644 index 000000000000..0f0acca28399 --- /dev/null +++ b/tests/assignment_expression/assignment_expression.js @@ -0,0 +1 @@ +this.size = this._origin = this._capacity = 0; diff --git a/tests/assignment_expression/jsfmt.spec.js b/tests/assignment_expression/jsfmt.spec.js new file mode 100644 index 000000000000..989047bccc52 --- /dev/null +++ b/tests/assignment_expression/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname);