From 1a0cad2ac136dfab6018e790336e60a0b37466b1 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 10:29:12 +1100 Subject: [PATCH 1/8] add new expression as a valid conditional expression parent for parantheses insertion - fixes #578 --- lib/6to5/generation/node/parentheses.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/6to5/generation/node/parentheses.js b/lib/6to5/generation/node/parentheses.js index 391f8ffc5c..2311c9f2c7 100644 --- a/lib/6to5/generation/node/parentheses.js +++ b/lib/6to5/generation/node/parentheses.js @@ -151,8 +151,10 @@ exports.ConditionalExpression = function (node, parent) { return true; } - if (t.isCallExpression(parent) && parent.callee === node) { - return true; + if (t.isCallExpression(parent) || t.isNewExpression(parent)) { + if (parent.callee === node) { + return true; + } } if (t.isConditionalExpression(parent) && parent.test === node) { From 95a3a02469cdb781b14f0986cf2a01902326f438 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:10:18 +1100 Subject: [PATCH 2/8] disable failing let scoping test --- .../es6-let-scoping/{switch-break => .switch-break}/exec.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/fixtures/transformation/es6-let-scoping/{switch-break => .switch-break}/exec.js (100%) diff --git a/test/fixtures/transformation/es6-let-scoping/switch-break/exec.js b/test/fixtures/transformation/es6-let-scoping/.switch-break/exec.js similarity index 100% rename from test/fixtures/transformation/es6-let-scoping/switch-break/exec.js rename to test/fixtures/transformation/es6-let-scoping/.switch-break/exec.js From 0e6bd3ed080458e65b4ae6aae3b7115b2c08bdc7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:13:59 +1100 Subject: [PATCH 3/8] v2.13.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6129a92926..8a567c45b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "6to5", "description": "Turn ES6 code into readable vanilla ES5 with source maps", - "version": "2.13.5", + "version": "2.13.6", "author": "Sebastian McKenzie ", "homepage": "https://6to5.org/", "repository": "6to5/6to5", From 9cf1c62147c464c9318a9519d65df1b05eb042bb Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:20:56 +1100 Subject: [PATCH 4/8] move optional async transformers down - fixes #580 --- lib/6to5/transformation/transform.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index 76e92a5e25..a678a476c2 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -54,9 +54,6 @@ _.each({ memoizationOperator: require("./transformers/playground-memoization-operator"), objectGetterMemoization: require("./transformers/playground-object-getter-memoization"), - asyncToGenerator: require("./transformers/optional-async-to-generator"), - bluebirdCoroutines: require("./transformers/optional-bluebird-coroutines"), - react: require("./transformers/react"), modules: require("./transformers/es6-modules"), propertyNameShorthand: require("./transformers/es6-property-name-shorthand"), @@ -65,6 +62,9 @@ _.each({ arrowFunctions: require("./transformers/es6-arrow-functions"), classes: require("./transformers/es6-classes"), + asyncToGenerator: require("./transformers/optional-async-to-generator"), + bluebirdCoroutines: require("./transformers/optional-bluebird-coroutines"), + objectSpread: require("./transformers/es7-object-spread"), exponentiationOperator: require("./transformers/es7-exponentiation-operator"), spread: require("./transformers/es6-spread"), From 519454c343b1fce4d7a57d0ce78a694dae29ef50 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:26:51 +1100 Subject: [PATCH 5/8] don't realias variables that are already declared in optional `coreAliasing` transformer - fixes #579 --- CHANGELOG.md | 11 +++++++++++ .../transformers/optional-core-aliasing.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2893667628..0f4a94a2c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,17 @@ _Note: Gaps between patch versions are faulty/broken releases._ +## 2.13.7 + + * **Bug Fix** + * Move optional async transformers down to avoid classes collision. + * Don't realias variables that are already declared in optional `coreAliasing` transformer. + +## 2.13.6 + + * **Bug Fix** + * Add `NewExpression` as a valid parent for parentheses insertion for `ConditionalExpression`. + ## 2.13.5 * **Bug Fix** diff --git a/lib/6to5/transformation/transformers/optional-core-aliasing.js b/lib/6to5/transformation/transformers/optional-core-aliasing.js index 90bb4621a7..8de2225f46 100644 --- a/lib/6to5/transformation/transformers/optional-core-aliasing.js +++ b/lib/6to5/transformation/transformers/optional-core-aliasing.js @@ -42,7 +42,7 @@ exports.ast = { context.skip(); return t.prependToMemberExpression(node, file._coreId); } - } else if (t.isReferencedIdentifier(node, parent) && !t.isMemberExpression(parent) && _.contains(ALIASABLE_CONSTRUCTORS, node.name)) { + } else if (t.isReferencedIdentifier(node, parent) && !t.isMemberExpression(parent) && _.contains(ALIASABLE_CONSTRUCTORS, node.name) && !scope.get(node.name, true)) { // Symbol() -> _core.Symbol(); new Promise -> new _core.Promise return t.memberExpression(file._coreId, node); } else if (t.isCallExpression(node)) { From 23d962b8385d2bf7353842a5451200b3f79ea756 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:39:50 +1100 Subject: [PATCH 6/8] Revert "move optional async transformers down - fixes #580" This reverts commit 9cf1c62147c464c9318a9519d65df1b05eb042bb. --- lib/6to5/transformation/transform.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index a678a476c2..76e92a5e25 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -54,6 +54,9 @@ _.each({ memoizationOperator: require("./transformers/playground-memoization-operator"), objectGetterMemoization: require("./transformers/playground-object-getter-memoization"), + asyncToGenerator: require("./transformers/optional-async-to-generator"), + bluebirdCoroutines: require("./transformers/optional-bluebird-coroutines"), + react: require("./transformers/react"), modules: require("./transformers/es6-modules"), propertyNameShorthand: require("./transformers/es6-property-name-shorthand"), @@ -62,9 +65,6 @@ _.each({ arrowFunctions: require("./transformers/es6-arrow-functions"), classes: require("./transformers/es6-classes"), - asyncToGenerator: require("./transformers/optional-async-to-generator"), - bluebirdCoroutines: require("./transformers/optional-bluebird-coroutines"), - objectSpread: require("./transformers/es7-object-spread"), exponentiationOperator: require("./transformers/es7-exponentiation-operator"), spread: require("./transformers/es6-spread"), From 2fb299da22548a66f5d039aa22e65fac2e04fe51 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:40:26 +1100 Subject: [PATCH 7/8] update 2.13.7 changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f4a94a2c4..0e7d0d742c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,6 @@ _Note: Gaps between patch versions are faulty/broken releases._ ## 2.13.7 * **Bug Fix** - * Move optional async transformers down to avoid classes collision. * Don't realias variables that are already declared in optional `coreAliasing` transformer. ## 2.13.6 From 66e9df6b0b4adecd97a73b911e5a94539058a188 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 24 Jan 2015 11:44:08 +1100 Subject: [PATCH 8/8] v2.13.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a567c45b0..0d3ec19904 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "6to5", "description": "Turn ES6 code into readable vanilla ES5 with source maps", - "version": "2.13.6", + "version": "2.13.7", "author": "Sebastian McKenzie ", "homepage": "https://6to5.org/", "repository": "6to5/6to5",