make PathHoister much more flexible, now ignores global references and will not deopt on reassignments and will instead hoist as high as it can, this also fixes #1529 since the order of operations has changed

This commit is contained in:
Sebastian McKenzie
2015-05-14 23:29:02 +01:00
parent d4fb924b6a
commit 14dddcda36
21 changed files with 192 additions and 52 deletions

View File

@@ -0,0 +1,5 @@
var Foo = React.createClass({
render: function render() {
return <div foo={notDeclared}></div>;
}
});

View File

@@ -0,0 +1,9 @@
"use strict";
var _ref = <div foo={notDeclared}></div>;
var Foo = React.createClass({
render: function render() {
return _ref;
}
});

View File

@@ -0,0 +1,11 @@
function render(text) {
return function () {
return <div>{text}</div>;
};
}
function render() {
return function (text) {
return <div>{text}</div>;
};
}

View File

@@ -0,0 +1,15 @@
"use strict";
function render(text) {
var _ref = <div>{text}</div>;
return function () {
return _ref;
};
}
function render() {
return function (text) {
return <div>{text}</div>;
};
}

View File

@@ -0,0 +1,7 @@
function render(text) {
text += "yes";
return function () {
return <div>{text}</div>;
};
}

View File

@@ -0,0 +1,11 @@
"use strict";
function render(text) {
text += "yes";
var _ref = <div>{text}</div>;
return function () {
return _ref;
};
}