-
-
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: mark
var
declarations in loops as not constant (#15027)
* fix: babel-traverse constant flag in bindings flag bindings in loops as not constant. Fixes: #13760 * Only mark `var`s directly inside loops * Fix CI error Co-authored-by: Stephane Rufer <stephane@arista.com>
- Loading branch information
1 parent
6d2b218
commit 8e9ae5f
Showing
14 changed files
with
172 additions
and
10 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
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
11 changes: 11 additions & 0 deletions
11
...gin-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-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,11 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (let i = 0; i < 5; i++) { | ||
const o = "foo"; | ||
const n = i; | ||
nodes.push(<div>{n}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
11 changes: 11 additions & 0 deletions
11
...in-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-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,11 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (let i = 0; i < 5; i++) { | ||
const o = "foo"; | ||
const n = i; | ||
nodes.push(<div>{n}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
9 changes: 9 additions & 0 deletions
9
...gin-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-3/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,9 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (const node of nodes) { | ||
nodes.push(<div>{node}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
9 changes: 9 additions & 0 deletions
9
...in-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-3/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,9 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (const node of nodes) { | ||
nodes.push(<div>{node}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
10 changes: 10 additions & 0 deletions
10
...gin-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-4/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 render() { | ||
const nodes = []; | ||
|
||
for (const node of nodes) { | ||
const n = node; | ||
nodes.push(<div>{n}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
10 changes: 10 additions & 0 deletions
10
...in-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-4/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 render() { | ||
const nodes = []; | ||
|
||
for (const node of nodes) { | ||
const n = node; | ||
nodes.push(<div>{n}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
11 changes: 11 additions & 0 deletions
11
...gin-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-5/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,11 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (let i = 0; i < 5; i++) { | ||
const o = "foo"; | ||
const n = i; | ||
nodes.push(<div>{o}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
11 changes: 11 additions & 0 deletions
11
...in-transform-react-constant-elements/test/fixtures/constant-elements/for-loop-5/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,11 @@ | ||
function render() { | ||
const nodes = []; | ||
|
||
for (let i = 0; i < 5; i++) { | ||
const o = "foo"; | ||
const n = i; | ||
nodes.push(<div>{o}</div>); | ||
} | ||
|
||
return nodes; | ||
} |
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