Fix PathHoister hoisting before bindings. (#5153)
Fixes #5149 and enables a few additional safe hoists.
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
var _ref = <p>Parent</p>;
|
||||
|
||||
var _ref2 = <div>child</div>;
|
||||
|
||||
var _ref3 = <p>Parent</p>;
|
||||
|
||||
(function () {
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
return <div>
|
||||
{_ref}
|
||||
<AppItem />
|
||||
</div>;
|
||||
return _ref;
|
||||
}
|
||||
}
|
||||
|
||||
const AppItem = () => {
|
||||
return _ref2;
|
||||
};
|
||||
});
|
||||
},
|
||||
_ref = <div>
|
||||
{_ref3}
|
||||
<AppItem />
|
||||
</div>;
|
||||
});
|
||||
@@ -1,16 +1,14 @@
|
||||
var _ref = <p>Parent</p>;
|
||||
|
||||
export default class App extends React.Component {
|
||||
render() {
|
||||
return <div>
|
||||
{_ref}
|
||||
<AppItem />
|
||||
</div>;
|
||||
return _ref;
|
||||
}
|
||||
}
|
||||
|
||||
var _ref2 = <div>child</div>;
|
||||
|
||||
const AppItem = () => {
|
||||
const _ref2 = <div>child</div>,
|
||||
AppItem = () => {
|
||||
return _ref2;
|
||||
};
|
||||
},
|
||||
_ref = <div>
|
||||
<p>Parent</p>
|
||||
<AppItem />
|
||||
</div>;
|
||||
@@ -0,0 +1,15 @@
|
||||
import React from "react";
|
||||
|
||||
const Parent = ({}) => (
|
||||
<div className="parent">
|
||||
<Child/>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Parent;
|
||||
|
||||
let Child = () => (
|
||||
<div className="child">
|
||||
ChildTextContent
|
||||
</div>
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
|
||||
const Parent = ({}) => _ref;
|
||||
|
||||
export default Parent;
|
||||
|
||||
let _ref2 = <div className="child">
|
||||
ChildTextContent
|
||||
</div>,
|
||||
Child = () => _ref2,
|
||||
_ref = <div className="parent">
|
||||
<Child />
|
||||
</div>;
|
||||
@@ -8,8 +8,9 @@ function render() {
|
||||
|
||||
function render() {
|
||||
const bar = "bar",
|
||||
renderFoo = () => <foo bar={bar} baz={baz} />,
|
||||
baz = "baz";
|
||||
renderFoo = () => _ref2,
|
||||
baz = "baz",
|
||||
_ref2 = <foo bar={bar} baz={baz} />;
|
||||
|
||||
return renderFoo();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from "react";
|
||||
|
||||
const HOC = component => component;
|
||||
|
||||
const Parent = ({}) => (
|
||||
<div className="parent">
|
||||
<Child/>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Parent;
|
||||
|
||||
let Child = () => (
|
||||
<div className="child">
|
||||
ChildTextContent
|
||||
</div>
|
||||
);
|
||||
Child = HOC(Child);
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from "react";
|
||||
|
||||
const HOC = component => component;
|
||||
|
||||
const Parent = ({}) => _ref;
|
||||
|
||||
export default Parent;
|
||||
|
||||
var _ref2 = <div className="child">
|
||||
ChildTextContent
|
||||
</div>;
|
||||
|
||||
let Child = () => _ref2;
|
||||
Child = HOC(Child);
|
||||
|
||||
var _ref = <div className="parent">
|
||||
<Child />
|
||||
</div>;
|
||||
Reference in New Issue
Block a user