From 5b6c0fcacde86dda98bbd66971d0f6fb95957544 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 2 Jan 2015 00:41:58 +1100 Subject: [PATCH] add whitespace after array and object expressions --- lib/6to5/generation/node/whitespace.js | 2 ++ .../transformation/es6-constants/destructuring/expected.js | 3 +++ .../transformation/es6-destructuring/array/expected.js | 1 + .../es6-destructuring/assignment-expression/expected.js | 1 + .../es6-destructuring/assignment-statement/expected.js | 1 + .../transformation/es6-destructuring/empty/expected.js | 1 + .../es6-destructuring/es7-object-rest/expected.js | 1 + .../transformation/es6-destructuring/for-in/expected.js | 1 + .../transformation/es6-destructuring/for-of/expected.js | 1 + .../es6-destructuring/member-expression/expected.js | 1 + .../transformation/es6-destructuring/mixed/expected.js | 1 + .../transformation/es6-destructuring/parameters/expected.js | 1 + .../es7-array-comprehension/multiple-if/expected.js | 1 + .../es7-array-comprehension/multiple/expected.js | 1 + .../optional-core-aliasing/es6-destructuring/expected.js | 1 + 15 files changed, 18 insertions(+) diff --git a/lib/6to5/generation/node/whitespace.js b/lib/6to5/generation/node/whitespace.js index 687e9497e9..344538d8cc 100644 --- a/lib/6to5/generation/node/whitespace.js +++ b/lib/6to5/generation/node/whitespace.js @@ -55,6 +55,8 @@ _.each({ Function: 1, Class: 1, For: 1, + ArrayExpression: { after: 1 }, + ObjectExpression: { after: 1 }, SwitchStatement: 1, IfStatement: { before: 1 }, CallExpression: { after: 1 }, diff --git a/test/fixtures/transformation/es6-constants/destructuring/expected.js b/test/fixtures/transformation/es6-constants/destructuring/expected.js index e95cc916ac..66a0ec1aa4 100644 --- a/test/fixtures/transformation/es6-constants/destructuring/expected.js +++ b/test/fixtures/transformation/es6-constants/destructuring/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); @@ -28,8 +29,10 @@ var _ref4 = _slicedToArray(_ref3, 2); var c = _ref4[0]; var d = _ref4[1]; var _ref5 = { e: 5, f: 6 }; + var e = _ref5.e; var f = _ref5.f; var _ref6 = { a: 7, b: 8 }; + var g = _ref6.a; var h = _ref6.b; diff --git a/test/fixtures/transformation/es6-destructuring/array/expected.js b/test/fixtures/transformation/es6-destructuring/array/expected.js index 9ed0154226..9fb14067aa 100644 --- a/test/fixtures/transformation/es6-destructuring/array/expected.js +++ b/test/fixtures/transformation/es6-destructuring/array/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/assignment-expression/expected.js b/test/fixtures/transformation/es6-destructuring/assignment-expression/expected.js index 1e12ecf071..af2b8a0984 100644 --- a/test/fixtures/transformation/es6-destructuring/assignment-expression/expected.js +++ b/test/fixtures/transformation/es6-destructuring/assignment-expression/expected.js @@ -6,6 +6,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/assignment-statement/expected.js b/test/fixtures/transformation/es6-destructuring/assignment-statement/expected.js index 607c84dd53..ffbb7febe2 100644 --- a/test/fixtures/transformation/es6-destructuring/assignment-statement/expected.js +++ b/test/fixtures/transformation/es6-destructuring/assignment-statement/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/empty/expected.js b/test/fixtures/transformation/es6-destructuring/empty/expected.js index dbf20c485f..03bf0aa988 100644 --- a/test/fixtures/transformation/es6-destructuring/empty/expected.js +++ b/test/fixtures/transformation/es6-destructuring/empty/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/es7-object-rest/expected.js b/test/fixtures/transformation/es6-destructuring/es7-object-rest/expected.js index 8a6ade7f6f..dbb29cb23d 100644 --- a/test/fixtures/transformation/es6-destructuring/es7-object-rest/expected.js +++ b/test/fixtures/transformation/es6-destructuring/es7-object-rest/expected.js @@ -2,6 +2,7 @@ var _objectWithoutProperties = function (obj, keys) { var target = {}; + for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; diff --git a/test/fixtures/transformation/es6-destructuring/for-in/expected.js b/test/fixtures/transformation/es6-destructuring/for-in/expected.js index 05780f099f..dc5db21a02 100644 --- a/test/fixtures/transformation/es6-destructuring/for-in/expected.js +++ b/test/fixtures/transformation/es6-destructuring/for-in/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/for-of/expected.js b/test/fixtures/transformation/es6-destructuring/for-of/expected.js index 567f5c48f1..331bb9a4ae 100644 --- a/test/fixtures/transformation/es6-destructuring/for-of/expected.js +++ b/test/fixtures/transformation/es6-destructuring/for-of/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/member-expression/expected.js b/test/fixtures/transformation/es6-destructuring/member-expression/expected.js index 3c54acdb95..fbaaa04184 100644 --- a/test/fixtures/transformation/es6-destructuring/member-expression/expected.js +++ b/test/fixtures/transformation/es6-destructuring/member-expression/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/mixed/expected.js b/test/fixtures/transformation/es6-destructuring/mixed/expected.js index d06f6220f7..2fac921701 100644 --- a/test/fixtures/transformation/es6-destructuring/mixed/expected.js +++ b/test/fixtures/transformation/es6-destructuring/mixed/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es6-destructuring/parameters/expected.js b/test/fixtures/transformation/es6-destructuring/parameters/expected.js index 3eeb1c713b..a378836955 100644 --- a/test/fixtures/transformation/es6-destructuring/parameters/expected.js +++ b/test/fixtures/transformation/es6-destructuring/parameters/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); diff --git a/test/fixtures/transformation/es7-array-comprehension/multiple-if/expected.js b/test/fixtures/transformation/es7-array-comprehension/multiple-if/expected.js index d725285d53..d5695f85cb 100644 --- a/test/fixtures/transformation/es7-array-comprehension/multiple-if/expected.js +++ b/test/fixtures/transformation/es7-array-comprehension/multiple-if/expected.js @@ -2,6 +2,7 @@ var seattlers = (function () { var _arr = []; + for (var _iterator = countries[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { var customers = _step.value; for (var _iterator2 = customers[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) { diff --git a/test/fixtures/transformation/es7-array-comprehension/multiple/expected.js b/test/fixtures/transformation/es7-array-comprehension/multiple/expected.js index 6f17584afe..05f2c6e76d 100644 --- a/test/fixtures/transformation/es7-array-comprehension/multiple/expected.js +++ b/test/fixtures/transformation/es7-array-comprehension/multiple/expected.js @@ -2,6 +2,7 @@ var arr = (function () { var _arr = []; + for (var _iterator = "abcdefgh".split("")[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { var x = _step.value; for (var _iterator2 = "12345678".split("")[Symbol.iterator](), _step2; !(_step2 = _iterator2.next()).done;) { diff --git a/test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js b/test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js index 712e62b592..2a92073140 100644 --- a/test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js +++ b/test/fixtures/transformation/optional-core-aliasing/es6-destructuring/expected.js @@ -5,6 +5,7 @@ var _slicedToArray = function (arr, i) { return arr; } else { var _arr = []; + for (var _iterator = _core.$for.getIterator(arr), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value);