Commit Graph

2 Commits

Author SHA1 Message Date
Dominic Gannaway
afb0a9e9cb Change how to signal React components for optimization
Summary:
Release notes: none

Currently, you register a React component tree with `__registerReactComponent(component)`.

This PR changes this global to `__optimizeReactComponentTree(rootComponent, config)`. Notice it now supports two arguments `rootComponent` and `config` – although config is optional.

This global now also returns the original component passed in, so it can be added to existing codebase without having to break logic flow.

This config argument allows the user to define how that React component tree will be optimized. More work will be added to this in upcoming PRs, but for now this PR is just a quick rename plus small refactor of the Prepack global.

I've also had to rename the global in all tests. I've also added some doc as to how all this works: https://github.com/facebook/prepack/wiki/React-Compiler
Closes https://github.com/facebook/prepack/pull/1527

Differential Revision: D7149728

Pulled By: trueadm

fbshipit-source-id: 8d04d8dec8c0a03a6ccdb9587884bf6375010203
2018-03-04 02:24:49 -08:00
Dominic Gannaway
cdec5c1005 Support more unary expression cases in pure scope
Summary:
Release notes: none

Support was added for delete unary expression cases a few days ago. This PR ensures all the other unary expression cases are also handled now too. The abstract temporal logic has been extended to support cases where the BaseValue of a reference was a EnvironmentRecord (when you destructure an object, this occurs).
Closes https://github.com/facebook/prepack/pull/1495

Differential Revision: D7075821

Pulled By: trueadm

fbshipit-source-id: 4cbbdc62ba03be41298c12aa57ce16d8d1225b2d
2018-02-23 16:38:53 -08:00