Commit Graph

658 Commits

Author SHA1 Message Date
Wuhan Zhou
db1db9090a Remove build changes for debugger
Summary:
Release note: none

After recent refactorings in Nuclide, we don't need to build the debugger differently anymore. We can use our transpiled code directly into Nuclide.
This undoes #1240
Closes https://github.com/facebook/prepack/pull/1274

Differential Revision: D6579982

Pulled By: JWZ2018

fbshipit-source-id: 58b487b3f1f020be27fc569c4f5219c660c1aad5
2017-12-15 11:08:16 -08:00
Dominic Gannaway
4e6c988723 Hoist and re-use React Elements when it's safe to do so
Summary:
Release note: none

This PR aims to do a few optimizations in terms of how JSX/React Elements are handled.

I've introduced a `ReactElementSet` class that aims to handle matching similar React Element/JSX structures by deeply iterating through the various properties on a JSX element. It uses a linked hash map, with the keys being the reference to the specific internal Prepack value. It handles objects, arrays, functions and React element structures.

These optimizations only happen on evaluated component trees.

```jsx
// before:
function MyComponent(props) {
  return <div><span>Hello world</span><span>Hello world</span></div>
}

// after:
function MyComponent(props) {
  var _0 = <span>Hello world</span>
  var _1 = <div>{_0}{_0}</div>
  return _1;
}
```

```jsx
// before:
function OtherComponent() {
  // ...
}

function MyComponent(props) {
  return <div><OtherComponent data={{a: 1, b: 2}} /></div>
}

// after
function OtherComponent() {
  // ...
}

function MyComponent(props) {
  _1 === void 0 && $f_0();
  return _1
}

function $f_0() {
  _1 = <div><OtherComponent data={{a: 1, b: 2}} /></div>
}
var _1;
```
Closes https://github.com/facebook/prepack/pull/1196

Differential Revision: D6578563

Pulled By: trueadm

fbshipit-source-id: 2f617fd80d4540228fcb60403cb97e672763876b
2017-12-15 08:08:19 -08:00
Dominic Gannaway
76902d4610 Exclude more invalid characters in an identifier
Summary:
Release notes: none

When working with the name generator and creating instinct names that include invalid characters, I noticed the output included these characters. Instead they should be replaced like other characters have.
Closes https://github.com/facebook/prepack/pull/1267

Differential Revision: D6577946

Pulled By: trueadm

fbshipit-source-id: 07db9e9cfd519cea128623df41dee35d60b8f8f3
2017-12-15 04:23:41 -08:00
Herman Venter
45d19dd152 Assign simple properties inside loops
Summary:
Release note: Basic support for do while loops with abstract bounds. Issue #1229

Take properties into account when doing fix point computation. Use property paths rather than phi nodes. Simplify code for local variables as well.
Closes https://github.com/facebook/prepack/pull/1255

Differential Revision: D6576293

Pulled By: hermanventer

fbshipit-source-id: 9e19704cbf5c8cbcc937bd99ec32af9ffe577ebf
2017-12-14 19:38:55 -08:00
Wuhan Zhou
45383c8785 Display heap graph in website
Summary:
Release note: add heap graph visualization to website
Moved from #1243

- read in the heap graph data from prepackSources result
- display the graph using [visjs](http://visjs.org/)
Closes https://github.com/facebook/prepack/pull/1265

Differential Revision: D6571860

Pulled By: JWZ2018

fbshipit-source-id: 4c2d9bae91eaffff58df8909214d4c7bc56d1359
2017-12-14 15:03:35 -08:00
Chris Blappert
78deba64a1 Fix ordering of binding mutation in additional functions
Summary:
Release Notes: none

Addresses issue #1244. Now we will put modifications to bindings just before the return statement of the additional function.
Also contains some minor refactors.
Closes https://github.com/facebook/prepack/pull/1251

Differential Revision: D6568331

Pulled By: cblappert

fbshipit-source-id: ea3ae2a783355175f0f23f82bce6543ac535b214
2017-12-14 10:24:58 -08:00
Simon Jensen
989210d5b8 When conditionally returning, add condition to non returning path
Summary:
Release note: Use conditional returns to refine the path condition. Fixes #1182

When one branch of a conditional is an abrupt completion add the join condition to the path condition. The previous path condition is stored in the saved completion and restored at join point.
Closes https://github.com/facebook/prepack/pull/1212

Reviewed By: hermanventer

Differential Revision: D6562943

Pulled By: simonhj

fbshipit-source-id: fcf53a7c54118628bd3f62e5010f4c1046fd1145
2017-12-13 17:09:45 -08:00
Wuhan Zhou
12f51fbfd1 Remove sending stopped event on debugger entry
Summary:
Release note: none

- Nuclide does not expect the first stop event from the debug adapters
- caused a bug where the state information is not shown on the first stop in Nuclide
- Remove sending a stopped event on entry
Closes https://github.com/facebook/prepack/pull/1256

Differential Revision: D6561599

Pulled By: JWZ2018

fbshipit-source-id: 942f644ce54e9b52fb5acbd3b217b210bf71b2b3
2017-12-13 15:54:32 -08:00
Jeffrey Tan
6fed368d01 Make _getTarget() easier to use
Summary:
Release Note: none

Remove scopes parameter from _getTarget() so that it is easier to use.
Closes https://github.com/facebook/prepack/pull/1254

Differential Revision: D6557152

Pulled By: yinghuitan

fbshipit-source-id: 7ceb9dc1799fc7960765ad816e73cd0a478a5712
2017-12-13 15:10:47 -08:00
Herman Venter
5e86f790aa Do not conflate prior saved completion with one from call.
Summary:
Release note: Fix bug #1262

The saved completion that is present before a function call should not be incorporated into the saved completion that is created inside the call, until after return completions have been appropriately joined and applied.
Closes https://github.com/facebook/prepack/pull/1263

Differential Revision: D6560937

Pulled By: hermanventer

fbshipit-source-id: 76e8d67f0ad2227dec9cf54f5f035a34f1941be3
2017-12-13 15:10:47 -08:00
Baptiste Manson
f4271d56f0 Correction of a few comment typos in the serializers
Summary:
Hi all,

It was a good way to get started on contributing.
Closes https://github.com/facebook/prepack/pull/1259

Differential Revision: D6558546

Pulled By: hermanventer

fbshipit-source-id: 815380c88aad36a7e1b34928b4eb6927a7c9d461
2017-12-13 12:09:40 -08:00
Dominic Gannaway
240fa7025d Change code to PP0020
Summary:
Release notes: none
Closes https://github.com/facebook/prepack/pull/1261

Differential Revision: D6558297

Pulled By: trueadm

fbshipit-source-id: 585a2fd93d29a8eff4f5a296874b56d4632552cf
2017-12-13 12:00:49 -08:00
Jhalley Badua De Castro
2f17f59751 Fix: Test output percentage should round down instead of up
Summary:
Release notes: Percentage output of passing tests (passed tests / total tests) should be rounded down instead of up.

From an example I encountered earlier, when we had number of tests passed = 1157 and total tests = 1159, we would display, "Passed: 1157/1159 100%". We should instead display "Passed: 1157/1159 99%"
Closes https://github.com/facebook/prepack/pull/1260

Reviewed By: hermanventer

Differential Revision: D6558323

Pulled By: jhalley

fbshipit-source-id: 01751bacb83760ae49a56a9ef56983fee94487d2
2017-12-13 12:00:48 -08:00
Dominic Gannaway
f18dab5463 Handle legacy React.createClass component bail outs
Summary:
Release notes: none

This adds detection support for the legacy `React.createClass`/`create-react-class` API so that we can safely bail out.
Closes https://github.com/facebook/prepack/pull/1257

Differential Revision: D6556374

Pulled By: trueadm

fbshipit-source-id: c71dcd3792be56c7134e743206c5830f1f46ae0d
2017-12-13 08:39:49 -08:00
Jhalley Badua De Castro
8c7b508162 Changed wrong use of console.log in the codebase to console.error
Summary:
Release note: Changed some erroneous console.log statements to console.error

This addresses issue https://github.com/facebook/prepack/issues/1201. Went through all uses of console.log in the codebase and converted them to console.error if that's what they're supposed to be.
Closes https://github.com/facebook/prepack/pull/1253

Reviewed By: hermanventer

Differential Revision: D6550963

Pulled By: jhalley

fbshipit-source-id: aec0f2f9a0e5745f563628b849fde110388b12cd
2017-12-12 16:34:24 -08:00
Chris Blappert
b935e80316 Turn return undefined into implicit return for additional functions
Summary: Closes https://github.com/facebook/prepack/pull/1252

Differential Revision: D6550203

Pulled By: cblappert

fbshipit-source-id: 24806cdcff78fbd3f57ad9bacfe27fe21a2e0025
2017-12-12 15:34:20 -08:00
Wuhan Zhou
559950acad Enable the debugger
Summary:
Release note: Debugger is available!

- remove the flag that hides the debugger
- to check whether to invoke the debugger:
    - inFilePath and outFilePath are specified when starting prepack (check in prepack-node.js)
    - if so, DebugChannel will read from inFile to see if debugger is attached
Closes https://github.com/facebook/prepack/pull/1249

Differential Revision: D6548604

Pulled By: JWZ2018

fbshipit-source-id: 1d4bee80d95c91da9853871b117cb8a939f4797b
2017-12-12 15:13:11 -08:00
James Nolan
3c9c6ac2a5 Make master/docs a single source of truth for gh-pages
Summary:
Release note: none

To address issue #956 .

The idea is to have all documentation (aka "the website") in a single `docs/` directory on the `master` branch like [Jest](https://github.com/facebook/jest/tree/master/docs) and [Relay](https://github.com/facebook/relay/tree/master/docs) do. This directory then serves as a single source of truth to publish the `gh-pages` branch.

This PR:
- Moves the current content of the `gh-pages` branch to a `docs/` directory in `master`
- Provides a bash script for maintainers to easily publish the `gh-pages` branch from the `docs/` directory. The script also builds `prepack.min.js` from master to make sure gh-pages always has the latest version of prepack.

Additionally, I noticed the `gh-pages` branch had two `prepack.min.js` files (one in `./` and one in `./js/`). I removed the first one because it is apparently not used but it may break other websites if they references that file.

0. Fork the repo to avoid modifying the real website

1. Change the site
`> git checkout master`
`> echo ".nav { background-color: chartreuse; }" >> docs/css/style.css`
`> git add docs/css/style.css`
`> commit -m "The navigation bar looks better in green"`
`> git push`

2. Run the publication script:
`> ./scripts/publish-gh-pages.sh`

3. Verify that the gh-pages has been updated:
`> git checkout gh-pages`
`> git pull`
`> git diff HEAD~ # should show the line you added`
Closes https://github.com/facebook/prepack/pull/1223

Differential Revision: D6547395

Pulled By: j-nolan

fbshipit-source-id: 6e6d3aec97c0bcc2555c421d6f4a889bcd8df208
2017-12-12 12:10:05 -08:00
Nikolai Tillmann
8d4e36092f Prepend additional functions prelude *after* splicing in function declarations
Summary:
Release notes: none

This addresses the --simpleClosures case mentioned in #1238 (but not the other case where we delay closure scope creation).

Prepend additional functions prelude *after* splicing in function declarations,
otherwise the ordering of the insertions is messed up.
Adding regression test.
Closes https://github.com/facebook/prepack/pull/1241

Differential Revision: D6546269

Pulled By: NTillmann

fbshipit-source-id: eb12c5bbba1b542c4e69599e5abf961359d41652
2017-12-12 11:39:01 -08:00
Manas
8ece9d1b3e Check if intrinsic abstract values have unique names
Summary:
Fix for #1155
Closes https://github.com/facebook/prepack/pull/1197

Differential Revision: D6546346

Pulled By: hermanventer

fbshipit-source-id: 7c24e1ce4ebf121a6d50176e7dc124d83f7cdad4
2017-12-12 11:39:00 -08:00
Herman Venter
a0ece2f8b4 Compute a fixed point for do-while
Summary:
Release note: Handle do-while loops with abstract bounds, for loop bodies only involving locals.

Issue: #1174

This adds a simple fixed point computation for do-while loops only. Currently only loops that updated only local variables and that have no abrupt exits are supported.

This is deliberately as minimal as possible to make review easier. Given the complexity of this feature, thoughtful review would be great.
Closes https://github.com/facebook/prepack/pull/1229

Differential Revision: D6546405

Pulled By: hermanventer

fbshipit-source-id: 205c336a83c17d03344941b13f0a5c6af7989131
2017-12-12 11:24:29 -08:00
Chris Blappert
192cd084b8 Cleanup files
Summary: Release Notes: none

Reviewed By: mzlee, NTillmann

Differential Revision: D6546282

fbshipit-source-id: 9c0e0dfa62a4a61dfbff13d5fd15967f4ef453fc
2017-12-12 11:12:24 -08:00
Chris Blappert
311c17f5d7 New alpha v0.2.6
Summary: New alpha version

Reviewed By: hermanventer

Differential Revision: D6542378

fbshipit-source-id: 8bba2f8d2f1cefd0587f014ace463bc25409f799
2017-12-11 22:33:44 -08:00
Chris Blappert
3573d4f941 Bump Prepack Version to v0.2.15
Summary:
Release Notes:
- Various Bugfixes, DevX improvements
- Add support for folding simple React class components
- Add --simpleClosures option to eagerly allocate space for captured variables
- Introduced Prepack Heap Object Graphs
- Various debugger features
Closes https://github.com/facebook/prepack/pull/1246

Differential Revision: D6541587

Pulled By: cblappert

fbshipit-source-id: 7464bf3e4316ba95bde852dd4559167688bf0fa3
2017-12-11 22:33:44 -08:00
Chris Blappert
89b92f998a Backed out changeset e9b4c8fbae69, diffs landed in wrong order
Summary: Landed Opensource stacked diffs in wrong order

Reviewed By: hermanventer

Differential Revision: D6542271

fbshipit-source-id: b77c72ba80fc2e9e8060786c68b0a4aaf35a9ff5
2017-12-11 22:33:44 -08:00
Chris Blappert
4afbbe711f Start alpha v0.2.16
Summary: Closes https://github.com/facebook/prepack/pull/1247

Differential Revision: D6541592

Pulled By: cblappert

fbshipit-source-id: e9b4c8fbae694ec5f2cfe0794f81367ee41d4bbd
2017-12-11 18:24:03 -08:00
Wuhan Zhou
982d6864f1 Add yarn command to build debugger
Summary:
Release note: none

The debugger needs to be built differently from the rest of Prepack to be compatible with Nuclide. This PR makes building the debugger into a separate command while still keeping the original command to build Prepack.
- make separate envs for building debugger and the rest of Prepack
- add `yarn build-debugger` command
Closes https://github.com/facebook/prepack/pull/1240

Differential Revision: D6534794

Pulled By: JWZ2018

fbshipit-source-id: 384dfbb7d77d46564e028c00a79e97b3657616b5
2017-12-11 15:39:24 -08:00
Jeffrey Tan
2b4037ae38 Add serialized identifier to heap graph label
Summary:
Release Note: add serialized identifier to heap graph label.

Also did a small refactoring to NameGenerator to make it easier to reuse.
Closes https://github.com/facebook/prepack/pull/1236

Differential Revision: D6537426

Pulled By: yinghuitan

fbshipit-source-id: d2eef16c204c466689e2be9471ffd53e4c79459a
2017-12-11 14:21:42 -08:00
Lukas Koebis
1130390174 Fix: Repeated argument identifiers with inlined expressions.
Summary:
PrePack generates duplicate argument names when inlining expressions. Take for instance the test in test/serializer/basic/CapturedScope.js. PrePacked with --inlineExpressions it generates several functions like

```
var $_1 = function (c, __scope_2, __scope_2) {
    var __captured__scope_2 = __scope_1(__scope_2);

    var __captured__scope_2 = __scope_1(__scope_2);

    __captured__scope_2[1]++;
    __captured__scope_2[2]++;
    return c();
  };
```
Closes https://github.com/facebook/prepack/pull/1218

Reviewed By: hermanventer

Differential Revision: D6536751

Pulled By: lukas1994

fbshipit-source-id: 8752964d7c099476a4cda3d42996c0aa77cbb5b9
2017-12-11 13:24:38 -08:00
Wuhan Zhou
10e51f3291 Build heap graph input
Summary:
Release note: none

- change heap graph data to be in the format expected by visjs
- add colors to each type of node
Closes https://github.com/facebook/prepack/pull/1242

Differential Revision: D6534752

Pulled By: JWZ2018

fbshipit-source-id: 74f8d7296ad5399014e9f60af3d86ea3ebf5102f
2017-12-11 11:43:28 -08:00
Christopher Blappert
219a4e009b Fix serialization of circular function captures
Summary:
Fixes #1222 by refusing to emit `.bind` calls when the arguments of the `.bind` would be identifiers for functions that have been generated by the ResidualFunctions code (because we can't guarantee that the ordering will be correct).
Closes https://github.com/facebook/prepack/pull/1227

Differential Revision: D6527609

Pulled By: cblappert

fbshipit-source-id: 55953c70eca5f230e5a9e371ac07219e7cafaa61
2017-12-08 18:24:01 -08:00
Nikolai Tillmann
f539656800 Fixing ordering issue with simple-closures.
Summary:
Release notes: none
Towards closing #1226.
Add regression test case.

Note that simple-closures doesn't work together with delay-initializations,
so delay-initializations now gets silently disabled when needed.
Closes https://github.com/facebook/prepack/pull/1237

Differential Revision: D6526798

Pulled By: NTillmann

fbshipit-source-id: 1b21961aaadd98af9503846b065689db38bd5302
2017-12-08 17:26:16 -08:00
Jeffrey Tan
22ffd045db Remove getSerializeObjectIdentifierOptional from ResidualHeapValueIdentifier
Summary:
Release Note: N/A

getSerializeObjectIdentifierOptional() relies on the internal identifier map to check if a value has been serialized and with identifier. I am going to change this assumption in later PR so refactor the code to remove this API.
Introduce new _serializedValueWithIdentifiers data structure to serve getSerializeObjectIdentifierOptional() API purpose.
Closes https://github.com/facebook/prepack/pull/1232

Differential Revision: D6520560

Pulled By: yinghuitan

fbshipit-source-id: 08a187a4a27c681f39187a14872bcd6919a55a26
2017-12-08 09:55:08 -08:00
Dominic Gannaway
d807bc8769 ReactElement tweaks and fixes
Summary:
After testing this in JS environments that don't support `Symbol`, React falls back to using `0xeac7`.

```js
const REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]("react.element") : 0xeac7;
```

This adds detection for this.

I've also excluded `_store` from being visited on ReactElement. This was picked up when evaluated DEV React bundles (where `_store` is set on the object).
Closes https://github.com/facebook/prepack/pull/1234

Differential Revision: D6520491

Pulled By: trueadm

fbshipit-source-id: c01b31e22f4f45a5e1933affd4b8c86c6bc72c41
2017-12-08 09:55:08 -08:00
Jeffrey Tan
eb2d6e58eb Introduce Prepack heap objects graph
Summary:
Release note: introduce Prepack heap objects graph.

This is the first PR to introduce prepack heap objects graph. The visualization is basic now(no coloring, legend for the nodes) and we need to figure out how best show the ref count.

I would like to land this first so that JWZ2018 can start integrate this into REPL website.

Later I am going to add the final identifier name into the node label.
Closes https://github.com/facebook/prepack/pull/1221

Differential Revision: D6520646

Pulled By: yinghuitan

fbshipit-source-id: 8cc0713b5d3fad82fb685dceeb7875894f908dbe
2017-12-08 09:55:08 -08:00
Artur Khusaenov
f5232f2242 Add information about integrating with other tools
Summary:
https://github.com/facebook/prepack/issues/1077
Closes https://github.com/facebook/prepack/pull/1231

Differential Revision: D6516839

Pulled By: NTillmann

fbshipit-source-id: 7597d401801016e12c0862eaefb583df63e002d4
2017-12-07 18:26:54 -08:00
Nikolai Tillmann
b4a30df0f0 Adding option --simpleClosures to eagerly allocate space for captured variables.
Summary:
Release notes: Adding option --simpleClosures to eagerly allocate space for captured variables.

This addresses #1226.

Adding option --simpleClosures, and brought back code that avoids delaying closure creation.
Adding test case.

From here, we could tweak the logic that triggers this behavior.
Closes https://github.com/facebook/prepack/pull/1228

Differential Revision: D6516797

Pulled By: NTillmann

fbshipit-source-id: 9c556036f8dd64c4c6004a436c3a391ca428eda9
2017-12-07 18:26:53 -08:00
Wuhan Zhou
e5093ba73b Autogenerate debug files
Summary:
Release note: none

- autogenerate the debugger communication files in the /tmp/ directory
- remove user input debug files in CLI
Closes https://github.com/facebook/prepack/pull/1230

Differential Revision: D6513228

Pulled By: JWZ2018

fbshipit-source-id: 80cc171549a8f8c03a80826a9af459c79ab239a3
2017-12-07 15:23:32 -08:00
Simon Jensen
1961e705f2 fatal error when missing a context in InternalConstruct
Summary:
The serializer is optimistically running code that can fail with a runtime error, without first setting up a context. When this fails, throw an error instead of asserting.
Closes https://github.com/facebook/prepack/pull/1225

Reviewed By: hermanventer

Differential Revision: D6510958

Pulled By: simonhj

fbshipit-source-id: 33523f6c1e66aeec460d386f211de6e76963cdf8
2017-12-07 11:45:46 -08:00
Wuhan Zhou
e545270f4e Refactor debugger into server, common, and adapter
Summary:
Release note: none
Summary;
- split debugger directory into `server`, `common`, and, `adapter`
- `adapter` and `common` have no dependencies on Prepack and can be moved into Nuclide
- make a copy of invariant.js into `common`
- make `FileIOWrapper` take in an absolute path so it can be used in both server and adapter sides
- Turn relative path into absolute path inside adapter channel
- Create debug communication files if they don't exist

With this refactoring, I can move the `adapter` and `common` directories into Nuclide and submit the code there too
Closes https://github.com/facebook/prepack/pull/1224

Differential Revision: D6510721

Pulled By: JWZ2018

fbshipit-source-id: 2a3f62392187924637aef7fa14260475f4db5de8
2017-12-07 11:45:45 -08:00
Artur Khusaenov
eb689cea14 Make it easy to find out which version of prepack is running
Summary:
Related to https://github.com/facebook/prepack/issues/1213

- [x] Added a command line option for printing out the version.
- [x] Added prepackVersion getter to Prepack object.

If it's fine for you I can take a task to display the version in prepack.io website
Closes https://github.com/facebook/prepack/pull/1220

Differential Revision: D6505466

Pulled By: hermanventer

fbshipit-source-id: 81efa8e2fcc39e2c777c4e67a20640be6fcc6f4d
2017-12-06 17:55:53 -08:00
Wuhan Zhou
c50ecdb57d Centralize debugger stopping
Summary:
Release note: none

- refactor stepping manager and breakpoint managers to return the stoppable object
- implement a stop event manager to handle the results of other two managers and decide whether a stop should happen
- remove onDebuggeeStop methods
Closes https://github.com/facebook/prepack/pull/1216

Differential Revision: D6500168

Pulled By: JWZ2018

fbshipit-source-id: 006632086ae52e2fa322637aefbc6ca2f9114365
2017-12-06 12:35:31 -08:00
Manas
43223d2d5d Adapt evaluators to deal with abstract conversion values
Summary:
Attempts fix for #1109 Awaiting feedback for the tests that have been written.
Closes https://github.com/facebook/prepack/pull/1211

Differential Revision: D6498825

Pulled By: hermanventer

fbshipit-source-id: 6bc6def013890561c70b77db6ba582902d677bcf
2017-12-06 11:09:51 -08:00
Herman Venter
f7b0cb8ecd Implement to.js privately
Summary:
Move the implementations of the to methods behind an interface so that we can reduce the Flow cycle length (as well as avoiding increasing it when a planned future request adds a new import to to.js).

This is a mechanical refactor with no new functionality.
Closes https://github.com/facebook/prepack/pull/1219

Differential Revision: D6494524

Pulled By: hermanventer

fbshipit-source-id: b5dbe45155e0276a9d42f2b26a90bb9b220ac1ea
2017-12-05 19:44:44 -08:00
Dominic Gannaway
f3355c91ca Fold simple class components
Summary:
Release note: Adds support for folding simple React class components

This PR adds the concept of "simple" class components. A "simple" class component is defined as:
- having only a "render" method or many method, i.e. `render()`, `_renderHeader()`, `_renderFooter()`
- having no lifecycle events
- having no state
- having no instance variables

The only things a class component should be able to access on "this" are:
- `this.props`
- `this.context`
- `this._someRenderMethodX()` etc

It does this by first attempting to evaluate any class component with the heuristics as if it were a simple class component. If that throws an error (entirely expected for most class components), it catches the error and falls back to trying to use the "complex" class component route for evaluation instead.

Furthermore, I've added "transforms". This allows post-transforms of the serialized AST for additional functions. The simple class component adds a transform to convert AST nodes of `this.props` to `props` and `this.context` to `context` respectfully – whilst adding arguments to the function; something that is necessary to convert simple class component render methods to functional components.

This PR also adds logic to squash simple class components into functional components at the root (as simple class components are easily convertible to functional components).
Closes https://github.com/facebook/prepack/pull/1204

Differential Revision: D6485508

Pulled By: trueadm

fbshipit-source-id: 06ebeebad5d23c0677a0e3f0cb8dd23c45735429
2017-12-05 08:24:12 -08:00
Simon Jensen
e808587c88 in es5 bablify the original code, not just the prepacked result
Summary:
Not sure why I didn't do it this way in the first place. Instead of applying babel to the prepacked code, apply it to them input source code. Make it an apples to apples comparison
Closes https://github.com/facebook/prepack/pull/1166

Differential Revision: D6360177

Pulled By: simonhj

fbshipit-source-id: 9c9a137178d54a36dc146e18c47b161426f09b5c
2017-12-04 21:06:22 -08:00
Wuhan Zhou
994daf7924 Implement step over in debugger
Summary:
Release note: none

-refactor step manager to account for other types of steppers
-add step over class
-setup pipeline to make stepover requests
Closes https://github.com/facebook/prepack/pull/1207

Differential Revision: D6480818

Pulled By: JWZ2018

fbshipit-source-id: 90b7e5ddb48576dfc9139238514c3fac3dabd71b
2017-12-04 17:29:53 -08:00
Jeffrey Tan
eb3456424d Update release version to v0.2.15-alpha.0
Summary: update version

Reviewed By: hermanventer

Differential Revision: D6479428

fbshipit-source-id: 4a262bfcaad301ba9b93989f6adbc235daeb5204
2017-12-04 17:09:05 -08:00
Jeffrey Tan
01b474187e Weekly release v0.2.14
Summary: New release to reduce npm package size.

Reviewed By: hermanventer

Differential Revision: D6479405

fbshipit-source-id: 35fc085a51d0b1e31007f95c65ae15ae97af059a
2017-12-04 17:09:03 -08:00
Herman Venter
cb78d1cedf Update expected number of test262 passes
Summary:
It seems that the numbers were meant for another version of the test262 repository.

The original pull request updated the test262 repository label, but the bot that synchronizes GitHub with our internal repo removed that update. That also causes the new test runner to fail, so disable that until we update the label properly.
Closes https://github.com/facebook/prepack/pull/1215

Differential Revision: D6477069

Pulled By: hermanventer

fbshipit-source-id: ed17b12c1e81d51465f9c4b76adf684961390fb0
2017-12-04 16:12:01 -08:00