Fix constant elements hoisted before declarator (#4804)

When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
This commit is contained in:
Scott Kyle
2016-12-03 16:58:38 -08:00
parent 5a9509205b
commit c438209718
3 changed files with 43 additions and 8 deletions

View File

@@ -0,0 +1,11 @@
function render() {
const bar = "bar", renderFoo = () => <foo bar={bar} />;
return renderFoo();
}
function render() {
const bar = "bar", renderFoo = () => <foo bar={bar} baz={baz} />, baz = "baz";
return renderFoo();
}

View File

@@ -0,0 +1,15 @@
function render() {
const bar = "bar",
_ref = <foo bar={bar} />,
renderFoo = () => _ref;
return renderFoo();
}
function render() {
const bar = "bar",
renderFoo = () => <foo bar={bar} baz={baz} />,
baz = "baz";
return renderFoo();
}