From 660d764390a65a3ff54d6e93fd801d4f9138c7da Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 18 Mar 2015 23:31:11 +1100 Subject: [PATCH 1/5] remove loop check when aliasing breaks, continues etc - fixes #1051 --- .../transformers/es6/block-scoping.js | 4 ---- .../es6-block-scoping/issue-1051/actual.js | 14 ++++++++++++ .../es6-block-scoping/issue-1051/expected.js | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js create mode 100644 test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js diff --git a/src/babel/transformation/transformers/es6/block-scoping.js b/src/babel/transformation/transformers/es6/block-scoping.js index 79eb0380c7..fadcd43544 100644 --- a/src/babel/transformation/transformers/es6/block-scoping.js +++ b/src/babel/transformation/transformers/es6/block-scoping.js @@ -527,10 +527,6 @@ class BlockScoping { } if (has.hasBreakContinue) { - if (!loop) { - throw new Error("Aren't in a loop and we're trying to reassign breaks and continues, something is going wrong here."); - } - for (var key in has.map) { cases.push(t.switchCase(t.literal(key), [has.map[key]])); } diff --git a/test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js b/test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js new file mode 100644 index 0000000000..88d3593f2a --- /dev/null +++ b/test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js @@ -0,0 +1,14 @@ +foo.func1 = function() { + if (cond1) { + for (;;) { + if (cond2) { + function func2() {} + function func3() {} + func4(function() { + func2(); + }); + break; + } + } + } +}; diff --git a/test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js b/test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js new file mode 100644 index 0000000000..099a69bb6a --- /dev/null +++ b/test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js @@ -0,0 +1,22 @@ +"use strict"; + +foo.func1 = function () { + if (cond1) { + for (;;) { + if (cond2) { + var _ret = (function () { + var func2 = function () {}; + + var func3 = function () {}; + + func4(function () { + func2(); + }); + return "break"; + })(); + + if (_ret === "break") break; + } + } + } +}; From 0914378bba21d00bb904bcd895f9f432ea4f9852 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 18 Mar 2015 23:34:26 +1100 Subject: [PATCH 2/5] add 4.7.16 changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da047d36aa..5088a79af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ _Note: Gaps between patch versions are faulty/broken releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 4.7.16 + + * **Bug Fix** + * Fix constructor spreading of typed arrays. + * Fix break/continue/return aliasing of non-loops in block scoping transformer. + ## 4.7.15 * **Bug Fix** From b166f352188a162a5ee04ff68a29a3a301ca4674 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 18 Mar 2015 23:34:37 +1100 Subject: [PATCH 3/5] add typed arrays to native types list - #1043 --- src/babel/types/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/babel/types/index.js b/src/babel/types/index.js index 9803d37e1a..ffe1d7b92d 100644 --- a/src/babel/types/index.js +++ b/src/babel/types/index.js @@ -25,7 +25,7 @@ function registerType(type: string, skipAliasCheck?: boolean) { } export var STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; -export var NATIVE_TYPE_NAMES = ["Array", "Object", "Number", "Boolean", "Date", "Array", "String", "Promise", "Set", "Map", "WeakMap", "WeakSet"]; +export var NATIVE_TYPE_NAMES = ["Array", "Object", "Number", "Boolean", "Date", "Array", "String", "Promise", "Set", "Map", "WeakMap", "WeakSet", "Uint16Array", "ArrayBuffer", "DataView", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Uint32Array", "Int32Array", "Float32Array", "Int16Array", "Float64Array"]; export var FLATTENABLE_KEYS = ["body", "expressions"]; export var FOR_INIT_KEYS = ["left", "init"]; export var COMMENT_KEYS = ["leadingComments", "trailingComments"]; From d28583bea103ebcda3faaf48da6fff67b7cff9c0 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 18 Mar 2015 23:36:04 +1100 Subject: [PATCH 4/5] v4.7.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 76219d2780..8e121c940d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "babel", "description": "Turn ES6 code into readable vanilla ES5 with source maps", - "version": "4.7.15", + "version": "4.7.16", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "repository": "babel/babel", From 8575392606fe54f39e48adb5a85e2a31d5ec7b61 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 18 Mar 2015 23:37:24 +1100 Subject: [PATCH 5/5] 4.7.16 --- packages/babel-runtime/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 8f68061b5e..fbfa4ea0d9 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,7 +1,7 @@ { "name": "babel-runtime", "description": "babel selfContained runtime", - "version": "4.7.15", + "version": "4.7.16", "repository": "babel/babel", "author": "Sebastian McKenzie ", "dependencies": {