-
-
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.
Mark hoisted react constant elements as #__PURE__ (#7372)
- Loading branch information
Showing
42 changed files
with
180 additions
and
57 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
8 changes: 6 additions & 2 deletions
8
...elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-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
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
12 changes: 9 additions & 3 deletions
12
...elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-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
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
4 changes: 3 additions & 1 deletion
4
...ugin-transform-react-constant-elements/test/fixtures/constant-elements/children/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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
var _ref = <span />; | ||
var _ref = | ||
/*#__PURE__*/ | ||
<span />; | ||
|
||
var Foo = React.createClass({ | ||
render: function () { | ||
|
4 changes: 3 additions & 1 deletion
4
...-elements/test/fixtures/constant-elements/class-assign-unreferenced-param-deopt/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
8 changes: 6 additions & 2 deletions
8
...orm-react-constant-elements/test/fixtures/constant-elements/compound-assignment/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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import React from 'react'; | ||
import Loader from 'loader'; | ||
|
||
var _ref = <Loader className="full-height" />; | ||
var _ref = | ||
/*#__PURE__*/ | ||
<Loader className="full-height" />; | ||
|
||
var _ref2 = <Loader className="p-y-5" />; | ||
var _ref2 = | ||
/*#__PURE__*/ | ||
<Loader className="p-y-5" />; | ||
|
||
const errorComesHere = () => _ref, | ||
thisWorksFine = () => _ref2; |
4 changes: 3 additions & 1 deletion
4
...n-transform-react-constant-elements/test/fixtures/constant-elements/constructor/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
8 changes: 6 additions & 2 deletions
8
...react-constant-elements/test/fixtures/constant-elements/deep-constant-violation/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
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
4 changes: 3 additions & 1 deletion
4
...ant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params-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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
function render() { | ||
var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
|
||
var _ref = <Component title={title} />; | ||
var _ref = | ||
/*#__PURE__*/ | ||
<Component title={title} />; | ||
|
||
return () => _ref; | ||
} |
4 changes: 3 additions & 1 deletion
4
...stant-elements/test/fixtures/constant-elements/dont-hoist-before-default-params/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
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
4 changes: 3 additions & 1 deletion
4
...nsform-react-constant-elements/test/fixtures/constant-elements/global-reference/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
8 changes: 6 additions & 2 deletions
8
...-transform-react-constant-elements/test/fixtures/constant-elements/html-element/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
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
4 changes: 3 additions & 1 deletion
4
...sform-react-constant-elements/test/fixtures/constant-elements/inner-declaration/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
4 changes: 3 additions & 1 deletion
4
...ct-constant-elements/test/fixtures/constant-elements/member-expression-constant/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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
function render() { | ||
this.component = "div"; | ||
|
||
var _ref = <this.component />; | ||
var _ref = | ||
/*#__PURE__*/ | ||
<this.component />; | ||
|
||
return () => _ref; | ||
} |
8 changes: 6 additions & 2 deletions
8
...-react-constant-elements/test/fixtures/constant-elements/member-expression-this/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
8 changes: 6 additions & 2 deletions
8
...sform-react-constant-elements/test/fixtures/constant-elements/member-expression/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
4 changes: 3 additions & 1 deletion
4
...transform-react-constant-elements/test/fixtures/constant-elements/param-and-var/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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
function fn(Component, obj) { | ||
var data = obj.data, | ||
_ref = <Component prop={data} />; | ||
_ref = | ||
/*#__PURE__*/ | ||
<Component prop={data} />; | ||
|
||
return () => _ref; | ||
} |
Oops, something went wrong.