-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix * update tests * review * fix * Update packages/babel-plugin-transform-for-of/src/index.ts Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com> * review * review --------- Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
c5c3d45
commit 380d186
Showing
13 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...transform-for-of/test/fixtures/assumption-iterableIsArray/for-of-modify-iterable/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
for (let o of arr) { | ||
arr = null; | ||
} |
4 changes: 4 additions & 0 deletions
4
...ransform-for-of/test/fixtures/assumption-iterableIsArray/for-of-modify-iterable/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
for (let _i = 0, _arr = arr; _i < _arr.length; _i++) { | ||
let o = _arr[_i]; | ||
arr = null; | ||
} |
10 changes: 10 additions & 0 deletions
10
...s/babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping-2/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e){ | ||
const r = []; | ||
for (const s of e) { | ||
e = null; | ||
r.push(s); | ||
} | ||
return r; | ||
} | ||
|
||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
10 changes: 10 additions & 0 deletions
10
.../babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping-2/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e){ | ||
const r = []; | ||
for (const s of e) { | ||
e = null; | ||
r.push(s); | ||
} | ||
return r; | ||
} | ||
|
||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
7 changes: 7 additions & 0 deletions
7
...el-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping-2/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"assumptions": { | ||
"iterableIsArray": true | ||
}, | ||
"targets": "node 4.0", | ||
"presets": ["env"] | ||
} |
10 changes: 10 additions & 0 deletions
10
...babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping-2/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e) { | ||
var r = []; | ||
for (var _i2 = 0, _e2 = e; _i2 < _e2.length; _i2++) { | ||
var s = _e2[_i2]; | ||
e = null; | ||
r.push(s); | ||
} | ||
return r; | ||
} | ||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
10 changes: 10 additions & 0 deletions
10
...ges/babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e){ | ||
const r = []; | ||
for (const s of e) { | ||
const e = s; | ||
r.push(e); | ||
} | ||
return r; | ||
} | ||
|
||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
10 changes: 10 additions & 0 deletions
10
...es/babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e){ | ||
const r = []; | ||
for (const s of e) { | ||
const e = s; | ||
r.push(e); | ||
} | ||
return r; | ||
} | ||
|
||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
7 changes: 7 additions & 0 deletions
7
...abel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"assumptions": { | ||
"iterableIsArray": true | ||
}, | ||
"targets": "node 4.0", | ||
"presets": ["env"] | ||
} |
10 changes: 10 additions & 0 deletions
10
...s/babel-preset-env/test/fixtures/plugins-integration/for-of-array-block-scoping/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function x(e) { | ||
var r = []; | ||
for (var _i2 = 0, _arr2 = e; _i2 < _arr2.length; _i2++) { | ||
var s = _arr2[_i2]; | ||
var _e = s; | ||
r.push(_e); | ||
} | ||
return r; | ||
} | ||
expect(x([1, 2, 3])).toEqual([1, 2, 3]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters