-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ghstack-poisoned]
- Loading branch information
Showing
52 changed files
with
2,522 additions
and
1,040 deletions.
There are no files selected for viewing
309 changes: 141 additions & 168 deletions
309
compiler/packages/babel-plugin-react-compiler/src/HIR/CollectHoistablePropertyLoads.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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
75 changes: 75 additions & 0 deletions
75
...ures/compiler/propagate-scope-deps-hir-fork/conditional-break-labeled.expect.md
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,75 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
// @enablePropagateDepsInHIR | ||
/** | ||
* props.b *does* influence `a` | ||
*/ | ||
function Component(props) { | ||
const a = []; | ||
a.push(props.a); | ||
label: { | ||
if (props.b) { | ||
break label; | ||
} | ||
a.push(props.c); | ||
} | ||
a.push(props.d); | ||
return a; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: ['TodoAdd'], | ||
isComponent: 'TodoAdd', | ||
}; | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR | ||
/** | ||
* props.b *does* influence `a` | ||
*/ | ||
function Component(props) { | ||
const $ = _c(5); | ||
let a; | ||
if ( | ||
$[0] !== props.a || | ||
$[1] !== props.b || | ||
$[2] !== props.c || | ||
$[3] !== props.d | ||
) { | ||
a = []; | ||
a.push(props.a); | ||
bb0: { | ||
if (props.b) { | ||
break bb0; | ||
} | ||
|
||
a.push(props.c); | ||
} | ||
|
||
a.push(props.d); | ||
$[0] = props.a; | ||
$[1] = props.b; | ||
$[2] = props.c; | ||
$[3] = props.d; | ||
$[4] = a; | ||
} else { | ||
a = $[4]; | ||
} | ||
return a; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: ["TodoAdd"], | ||
isComponent: "TodoAdd", | ||
}; | ||
|
||
``` | ||
22 changes: 22 additions & 0 deletions
22
...rc/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/conditional-break-labeled.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,22 @@ | ||
// @enablePropagateDepsInHIR | ||
/** | ||
* props.b *does* influence `a` | ||
*/ | ||
function Component(props) { | ||
const a = []; | ||
a.push(props.a); | ||
label: { | ||
if (props.b) { | ||
break label; | ||
} | ||
a.push(props.c); | ||
} | ||
a.push(props.d); | ||
return a; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: ['TodoAdd'], | ||
isComponent: 'TodoAdd', | ||
}; |
Oops, something went wrong.