Commit Graph

1450 Commits

Author SHA1 Message Date
Dominic Gannaway
e4875197fb Improve inlining of React.createContext (#2098)
Summary:
Release notes: none

Whilst working on adding React Native mocks, I ran into cases where context should be inlining but it wasn't. It now is inlining far better, with more test coverage. Furthermore, we now have a new config flag to pass to `__optimizeReactComponentTree`, in the case of `isRoot` to state that the tree is a root component tree (rather than a a branch of another tree).
Closes https://github.com/facebook/prepack/pull/2098

Differential Revision: D8348381

Pulled By: trueadm

fbshipit-source-id: 5e01bd77437e8bc3d1f22ff47d668897152203a0
2018-06-11 04:36:50 -07:00
Peter van der Zee
485ea766fa Fix os.cpus() and worker count in prepack test runner
Summary:
Turns out os.cpus() can return [] and undefined.

Additionally, it seems to me like any number below 4 could lead to an empty pool so I tried to address that too.

Reviewed By: NTillmann

Differential Revision: D8332896

fbshipit-source-id: 60e082a4f0d18e72f95b76732a50adeccb2d333d
2018-06-11 00:56:05 -07:00
Herman Venter
3706b936c3 Record current values in the bindings map (#2099)
Summary:
Release note: none

Effects objects are currently stateful: If you apply the effects it becomes an undo map and if you undo the effects, it becomes a redo map.

In most situations this is just fine since apply and undo are usually nicely paired. In some situations, however, we end up applying or undoing the same effects object twice in a row. This causes issues that are extremely hard to debug. I've tried to purge the code base of all such cases, but they just keep coming up. In essence, I am trying to maintain a very subtle invariant that is quite hard to check and I am failing.

I now give up on this invariant and am making Effects into an object that is immutable except when being constructed incrementally. This is the first step towards that.
Closes https://github.com/facebook/prepack/pull/2099

Differential Revision: D8334815

Pulled By: hermanventer

fbshipit-source-id: ab508ed6c6c42969c8fda842fa20b55f7773c2cc
2018-06-08 14:49:44 -07:00
Dan Abramov
2cd33523bf Remove a hacky global for context tests (#2102)
Summary:
The code didn't work without it sometimes because conceptually all code outside of `getTrials` is an isolated "bundle". We can only access its internals through the `Root` reference. This fixes the tests to follow this constraint and removes the hack.
Closes https://github.com/facebook/prepack/pull/2102

Differential Revision: D8333634

Pulled By: gaearon

fbshipit-source-id: 1fb24751490042beae55a133f64351a9be9f903c
2018-06-08 10:24:52 -07:00
Andres Suarez
9964f35014 Remove kcheck and dedupe yarn.lock deps
Reviewed By: trueadm

Differential Revision: D8327228

fbshipit-source-id: 1e27d6fbc70cd2a55aa819ab4f7f555ea7e76d91
2018-06-08 07:39:42 -07:00
Manas
e24f02d5ab Fix class serialization test (#2100)
Summary:
Release note: none

Fixes a class serialisation test.
Closes https://github.com/facebook/prepack/pull/2100

Differential Revision: D8331997

Pulled By: trueadm

fbshipit-source-id: 9b3624e817a6bfa961ae4d1e494eea6ac7603c4b
2018-06-08 07:08:55 -07:00
Peter van der Zee
ab6dd11806 Back out "Drop eslint-plugin-babel from xplat/prepack"
Summary: Original commit changeset: c8b1f94086e0

Reviewed By: mjesun

Differential Revision: D8330860

fbshipit-source-id: 61015dda2c20d112c7d603cca42bf14417100471
2018-06-08 04:23:38 -07:00
Ricardo N Feliciano
3f67476608 Switch to CircleCI 2.0. (#2094)
Summary:
Release note: Migrate to CircleCI 2.0

Hey everyone,

If you don't know, CircleCI 1.0 [is being EOL'd](https://circleci.com/blog/sunsetting-1-0/) at the end of August. I noticed that this project uses CircleCI 1.0 and so in the spirit of open source I wanted to submit a PR to do the migration.

The **TL:DR;** of this PR is that it converts the CircleCI 1.0 configuration file into the equivalent CircleCI 2.0 configuration file. I'd say that the new config file is 99% the same software-wise. Here's the two changes:
- the Yarn version was bumped  from v1.1.0 to the current version on the Docker Library Node images, which is v1.3.
- I split the running of tests and checks from a single, sequential build into 3 separate jobs.

For that latter point, I noticed that if you averaged the CircleCI 1.0 build time for this project for the last 3 passing `master` builds, the average build time is **32m 49s**. I ran this PR on CircleCI 2.0 and the average build time for the last 3 passing builds is **13m 22s**.

Basically, this PR allows this project to migrate to CircleCI 2.0 before the August 2018 EOL of 1.0 as well as decrease build times by 49%.

I'm happy to answer any questions or help with any tweaks to get this PR merged if you choose to do so.
Closes https://github.com/facebook/prepack/pull/2094

Differential Revision: D8324655

Pulled By: NTillmann

fbshipit-source-id: 239410c21fa035923ffb81f53d094c542837ab77
2018-06-07 16:35:09 -07:00
Roman Khotsyn
297e942a42 Fixing invalid code generation for abstract member access (#2084) (#2093)
Summary:
There is a case when prepack emits non-computed member expressions in `rebuildObjectProperty` for properties which cannot be used this way. This PR is to fix #2084 .
Closes https://github.com/facebook/prepack/pull/2093

Differential Revision: D8319018

Pulled By: hotsnr

fbshipit-source-id: a27b943b541f6210d44c1e9a5887915eec5c6359
2018-06-07 13:16:56 -07:00
Dominic Gannaway
244679189b Fix lint issues on master (#2095)
Summary:
Release notes: none

Fixes the current lint issues on master.
Closes https://github.com/facebook/prepack/pull/2095

Differential Revision: D8316331

Pulled By: trueadm

fbshipit-source-id: 67a60b9cfb728d64dca0e03585e206d9be53193e
2018-06-07 10:09:43 -07:00
Dan Caspi
65900a08a0 Making prepack not break with lazy modules definition
Summary:
A quick fix to make prepack not crash with the new switch statement structure of the bundle.
This is a dup of D8269827, which, for some reason, `jf get` failed to import.

Reviewed By: NTillmann

Differential Revision: D8298075

fbshipit-source-id: 4572bfd918e73e5bf95fde736e9daf44f15d5de8
2018-06-07 04:38:26 -07:00
Peter van der Zee
fa5fe49c74 Drop eslint-plugin-babel from xplat/prepack
Summary: Drop eslint-plugin-babel because the plugin doesn't appear to be used at all in this project.

Reviewed By: mjesun

Differential Revision: D8298145

fbshipit-source-id: 4c81abc838cdc6619e8f900d032057ec7008c623
2018-06-07 01:23:54 -07:00
Jeffrey Tan
0f1384aabd New alpha release v0.2.39-alpha.0
Summary: New alpha release v0.2.39-alpha.0

Reviewed By: hermanventer

Differential Revision: D8305539

fbshipit-source-id: 19e8aa014e5ebd047bbe154b29d311d2f78f2198
2018-06-06 21:58:21 -07:00
Jeffrey Tan
3a24fc596c Weekly release v0.2.38
Summary:
* Adds __describe that can pretty print abstract values to assist debugging
* Implemented step out feature in debugger

Reviewed By: hermanventer

Differential Revision: D8305566

fbshipit-source-id: 7e0765fa49d82e784abad199dd65c32cd9b1e7f2
2018-06-06 21:58:21 -07:00
Andres Suarez
f20de93335 Prettier 1.13.4 fixes
Reviewed By: trueadm

Differential Revision: D8301297

fbshipit-source-id: f2fb9562680aa0c1de717f8f162ae8cb611c27f4
2018-06-06 12:49:59 -07:00
Peter van der Zee
5c507bc847 Bump Prettier to 1.13.4 on xplat
Summary:
@public

Bump Prettier to use version 1.13.4
All code changes are caused by running Prettier and should only affect files that have an `format` header.
All other changes caused by yarn.

Reviewed By: ryanmce

Differential Revision: D8251255

fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
2018-06-06 05:38:59 -07:00
Dominic Gannaway
c551500aeb Call React createDefaultPropsHelper creates function on init (#2087)
Summary:
Release notes: none

This fixes an issue where `createDefaultPropsHelper` gets created in a branch of effects, and is cached on the `realm`. Instead `createDefaultPropsHelper` should get created during the init phase, so the function is accessible throughout the entire lifecycle of the realm.
Closes https://github.com/facebook/prepack/pull/2087

Differential Revision: D8290010

Pulled By: trueadm

fbshipit-source-id: 324035cdd3c8a951c44849e1ccbfca9798a551b0
2018-06-05 17:54:45 -07:00
Herman Venter
eaf9ade317 Simplify joinPossiblyNormalCompletions (#2086)
Summary:
Release note: none

Rewrite joinPossiblyNormalCompletions to be much simpler and to not do any rotations.

There are some bug fixes to come that will need this. I'm breaking this out separately to make it more understandable.
Closes https://github.com/facebook/prepack/pull/2086

Differential Revision: D8288110

Pulled By: hermanventer

fbshipit-source-id: 66cc7ac3b578100daaf84a659cde0024ddae5b66
2018-06-05 14:57:35 -07:00
Herman Venter
a60b15f272 Simplify getCapturedEffects (#2078)
Summary:
Release note: none

Remove an unneeded option from getCapturedEffects and strengthen the return type.
Closes https://github.com/facebook/prepack/pull/2078

Differential Revision: D8283383

Pulled By: hermanventer

fbshipit-source-id: e6da135c6356419d355f0eecb5ead9020a4c7bea
2018-06-05 12:06:24 -07:00
Herman Venter
0703a1b290 Remove code that is no longer needed. (#2077)
Summary:
Release note: none

Deletes some code that is no longer needed.
Closes https://github.com/facebook/prepack/pull/2077

Differential Revision: D8272617

Pulled By: hermanventer

fbshipit-source-id: a6a715da55846a7feb29dade8bd6146735b94913
2018-06-04 20:57:42 -07:00
Herman Venter
c7cdaa3443 Renames to help avoid confusing fork and join (#2076)
Summary:
Release note: none

This is a mechanical rename refactor and dead/redundant code deletion that makes no semantic changes.
Closes https://github.com/facebook/prepack/pull/2076

Differential Revision: D8267651

Pulled By: hermanventer

fbshipit-source-id: b47cf58202135c8af9c0701921889469280b2a08
2018-06-04 16:53:45 -07:00
David Cai
5f3a699466 Implemented step out feature in debugger (#2062)
Summary:
Release Notes:   Implemented step out feature in debugger

Changes are inspired by 994daf7924

Started a test/debugger directory for debugger tests. Currently just aggregating test cases in there until I have time to write a debugger specific test runner.
Closes https://github.com/facebook/prepack/pull/2062

Differential Revision: D8266175

Pulled By: caiismyname

fbshipit-source-id: 2da775ac23ac09800565f21d2e62d68864009e5a
2018-06-04 15:56:50 -07:00
Manas
f6e250b3e0 Add __describe to assist debugging abstracts
Summary:
Release note: Adds __describe that can pretty print abstract values to assist debugging.

Addresses #2018
Closes https://github.com/facebook/prepack/pull/2049

Differential Revision: D8249078

Pulled By: trueadm

fbshipit-source-id: 70a2f8c981bcad77f8ff83da56e2e83fc28c294d
2018-06-03 14:10:25 -07:00
Sapan Bhatia
0dd23e364a Weekly release v0.2.37
Summary:
For reference, the commit with the release version can be seen here: 7e9e713b3a
Closes https://github.com/facebook/prepack/pull/2079

Differential Revision: D8248778

Pulled By: sb98052

fbshipit-source-id: 3f6533e8e083adfb0b964a5d4e7657964f93da96
2018-06-03 08:28:15 -07:00
David Cai
d96eaf45c4 Show callstack in browser upon REPL crashes
Summary:
Fixing some incompatibility between heapGraph and `__optimize()`.
Essence of the issue was an implicit assumption that only one visitor would visit certain entries.

Original Issue: https://github.com/facebook/prepack/issues/1732
Closes https://github.com/facebook/prepack/pull/2021

Reviewed By: trueadm

Differential Revision: D8248761

Pulled By: caiismyname

fbshipit-source-id: dd27487b490e3924fdc0fe6aaca7f1c103e137cb
2018-06-03 07:38:28 -07:00
Dominic Gannaway
8bf0e78a58 Move fbjs to deps
Summary:
Release notes: adds fbjs as a dependency

Should fix https://github.com/facebook/prepack/issues/2081
Closes https://github.com/facebook/prepack/pull/2082

Differential Revision: D8247436

Pulled By: trueadm

fbshipit-source-id: 52c9b9374f8a5762ea8262e539222f4f20c88ce1
2018-06-02 12:46:36 -07:00
Antony Jones
cede566f2a Add parcel plugin to readme
Summary: Closes https://github.com/facebook/prepack/pull/2080

Differential Revision: D8247440

Pulled By: trueadm

fbshipit-source-id: 181a78bb68853e81eab0a231f73da3d666571ed3
2018-06-02 12:46:36 -07:00
Dominic Gannaway
318da6c7f6 Refactor of createElement props/config to fix bugs + use snapshotting
Summary:
Release notes: fixes a range of spread bugs with ReactElements

This is a very important PR for React reconciliation, it fixes many undiscovered bugs and adds a huge amount of test coverage that was previously missing.

Whilst testing quite complex cases of JSX spreads in combination with defaultProps on our internal bundle I noticed that there were some bugs appearing, but because the branches where these bugs were appearing were not used on firstRender, it meant we got away with it on our internal tests.

We now use snapshotting and properly evaluateForEffects when recovering from `Object.assign` with ReactElement creation of config/props. We also properly use the `temporalAlias` to ensure we reference the correct object.
Closes https://github.com/facebook/prepack/pull/2070

Differential Revision: D8243793

Pulled By: trueadm

fbshipit-source-id: e8c37aa6750c0a6d41f12249d8872004da3ab3a6
2018-06-02 06:34:27 -07:00
Sapan Bhatia
ba701ade59 Updated to Flow v0.73.0
Summary:
Updated version of Flow to 0.73.0.
Closes https://github.com/facebook/prepack/pull/2075

Differential Revision: D8245928

Pulled By: sb98052

fbshipit-source-id: 42f1d394c88789802ee8b9290a0f53d0a59abc2a
2018-06-01 19:38:50 -07:00
Herman Venter
f101b51472 Do not join prematurely.
Summary:
Release note: none

Quite a few of the outstanding issues arise because generators are either deleted or duplicated. After spending much time debugging such issues, I've realized that the code is not making a clear distinction between forking and joining and as a result we sometimes join when we should fork and this leads to problems.

I'm now systematically going through all the methods in Join and making sure they do the right thing in a less mysterious way. The subject of this pull request is method joinPossiblyNormalCompletionWithAbruptCompletion. The result of this method should be a just a fork because a join may not be required or desirable. The name is thus not helpful and so I've renamed it to replacePossiblyNormalCompletionWithForkedAbruptCompletion.

This broke some use cases that require the result to be joined. They had to be rewritten to use extractAndJoinCompletionsOfType to join just those parts of the fork that actually join at those code constructs.

While debugging the tests that inevitably broke while making these changes, a few other issues were uncovered that are also fixed in this PR. One of them involves specializing the result value of the abrupt completion that is being spliced into possibly normal completion (because a join is being composed into a fork).
Closes https://github.com/facebook/prepack/pull/2074

Differential Revision: D8244536

Pulled By: hermanventer

fbshipit-source-id: eded7e7233101ad5c288cd8730bf6fd3cbf82904
2018-06-01 17:55:28 -07:00
Nikolai Tillmann
51a3c47836 Properly havoc object property bindings that might have been deleted.
Summary:
Release notes: None

This fixes #2067.

Adding regression test.
Closes https://github.com/facebook/prepack/pull/2071

Differential Revision: D8243118

Pulled By: NTillmann

fbshipit-source-id: e6ddc6f45d60f1a7579d38a73f22c5a0950a877f
2018-06-01 16:25:09 -07:00
Herman Venter
1f1a97503b Make it clearer that some completions are forks rather than joins.
Summary:
Release note: Rename refactor make it clearer that forks are not joins

Mechanical refactor to help with future documentation.

To come in a future PR: making sure forks are not joined except by means of extractAndJoinCompletionsOfType.
Closes https://github.com/facebook/prepack/pull/2063

Differential Revision: D8226967

Pulled By: hermanventer

fbshipit-source-id: 9c6d6cb300a82ae0f7c26284ee4a60ae6edebd03
2018-06-01 14:37:32 -07:00
Dominic Gannaway
679b7d092e Upgrade ESlint to support ES2018
Summary:
Release notes: none

Make our linter use the latest `ecmaVersion`. https://eslint.org/docs/user-guide/configuring#deprecated
Closes https://github.com/facebook/prepack/pull/2069

Differential Revision: D8230681

Pulled By: trueadm

fbshipit-source-id: fddaeef4692cf45e929f243a7255518705a25727
2018-05-31 17:04:35 -07:00
Dominic Gannaway
7bfd0d1fd9 Fix #2051 and handle all Array.prototype methods for unknown arrays
Summary:
Release notes:

This PR is a follow up to https://github.com/facebook/prepack/pull/2051, which we found to have issues and had to be reverted. The main cause of the issue in the previous PR was that `realm.evaluateWithAbstractConditional` was being given a `ReturnCompletion`, which are a type of `AbruptCompletion`. There is logic to correctly throw such completions. So instead of passing a `ReturnCompletion` to `realm.evaluateWithAbstractConditional`, we instead pass the value and then wrap the `realm.evaluateWithAbstractConditional` call with a function that adds back on the `ReturnCompletion`.

Fixing this brought about a bunch of deeper issues that were causing tests to fail (regression tests added) around the unknown array and its prototype methods. We were only handling a handful of methods before, but that was fragile. So this PR now adds support for all the of current prototype methods on `Array` for unknown arrays – following the spec as to what the return value should be in each case.

Finally, a change was made to the React reconciler to ensure that we return the unknown array in cases where it is passed an unknown array without a ReactHint (which is expected, but was missed and thus a regression from a previous PR).
Closes https://github.com/facebook/prepack/pull/2061

Differential Revision: D8229848

Pulled By: trueadm

fbshipit-source-id: 02dbd1c7e1cd03de4f6745daed57d13ea24537a8
2018-05-31 17:04:35 -07:00
Paulo Cunha
a10ac631b4 Make more files flow strict
Summary:
Release Notes: none

I made more files flow strict, to move forward on https://github.com/facebook/prepack/issues/1941.
I'm using `/* flow strict-local */` to avoid the problem with importing non-strict files for now.

I created a small utility to check for an undefined type or null value, but am wondering if it is a bit pointless. Would like some feedback on that. Thanks!
Closes https://github.com/facebook/prepack/pull/2048

Differential Revision: D8225232

Pulled By: hermanventer

fbshipit-source-id: b4d29d170722a6652f0c3428949b296273a9d953
2018-05-31 12:44:05 -07:00
Dan Abramov
9725823d4f Add regression tests for #1837, #1840, and #1848
Summary:
Since #1837 and #1848 got fixed at some point, this adds tests to verify they don't regress.
Closes https://github.com/facebook/prepack/pull/2066

Differential Revision: D8221658

Pulled By: gaearon

fbshipit-source-id: a31fc733964ae697252225993b813e8d5a445ed1
2018-05-31 08:23:02 -07:00
Dominic Gannaway
bcf7255ce3 Do not emit final property assignments when havocing
Summary:
Release notes: none

When in strict mode, emitting property assignments to a frozen object (ReactElement in this case) causes a runtime error. We shouldn't be emitting ReactElement properties when we havoc the object. Unfortunately, we can't do this to all final objects, because our internal snapshot test fails when doing this (because the final object has properties that are conditional and thus delayed, so we need all its bindings to be "flushed" at the point of havocing). As a more thorough future fix, we should probably add a separate codepath for serializing objects that are final (we delay the entire object being emitted until all its properties are ready, like the ReactElement serializer does).

Interestingly, the output contains an unused variable that should be removed NTillmann?

```js
var _0 = function (props, context) {
    "use strict";

    var _J = props;
    var _$0 = _J.b;

    var _1 = _$0 !== null;

    if (_1) {
      var _$1 = _J.b;
      var _$2 = _$1.x;

      var _5 = _$2 !== null;

      if (_5) {
        var _$3 = _J.b;
        var _$4 = _$3.x;
      }
    }

    var _$5 = _J.c;
    var _$6 = _J.someAbstractFunction;

    var _A = _1 ? _5 ? _$4 : null : null;

    var _8 = {  // <-- why has this not been removed? can we not mark the entry as "pure"
      a: 1,
      b: _A,
      c: _$5
    };
    _8.a = 1;
    _8.b = _A;
    _8.c = _$5;

    var _F = <div a={1} b={_A} c={_$5} />;

    var _$7 = props.someAbstractFunction(_F);

    return _F;
  };
```
Closes https://github.com/facebook/prepack/pull/2065

Differential Revision: D8221498

Pulled By: trueadm

fbshipit-source-id: e508cba2e930bec9c913efae3c653637671098c6
2018-05-31 07:27:44 -07:00
Herman Venter
bb12168a0d Make joinPossiblyNormalCompletionWithAbruptCompletion live up to its advertised behavior
Summary:
Release note: none

joinPossiblyNormalCompletionWithAbruptCompletion said that it always returned effects with completions of type JoinedAbruptCompletions. Some callers took it at is word. Turns out it was lying.

Fixed things so that the advertising is correct. Also fixed an issue with a generator being lost during joining. (This was a latent bug uncovered by this fix.)

Refactored the code that fails when a loop body contains both break and continue completions governed by abstract conditions.
Closes https://github.com/facebook/prepack/pull/2030

Reviewed By: trueadm

Differential Revision: D8188966

Pulled By: gaearon

fbshipit-source-id: 7b74d63ee34b6492614a4386e6ad7955c96cbf78
2018-05-31 06:51:12 -07:00
Nikolai Tillmann
0b0b675fbd A step forward towards fixing havocing object property bindings.
Summary:
Release notes: Improvements towards fully supporting havocing object property bindings.

This fixes #2013 and fixes #2017.

There are varios TODOs in the new code; whatever didn't violate any existing tests throws a FatalError,
while the other cases still silently do the wrong thing.
Once this PR lands, I'll file issues for the various TODOs which can then be worked on separately.
In any case, the changes in this PR are strictly making things better.

Adding regression tests from the fixed issues.
Closes https://github.com/facebook/prepack/pull/2023

Reviewed By: trueadm

Differential Revision: D8174176

Pulled By: NTillmann

fbshipit-source-id: 299af8546ea7474a67fc0d75ce6ad8649b060db7
2018-05-30 16:02:06 -07:00
Dominic Gannaway
d94f231718 React option better stats
Summary:
Release notes: adds `reactOptimizeNestedFunctions` flag to enable nested optimized functions from React components

This PR adds output for components that fail to inline (during evaluation process) and adds a flag so we can enable/disable nested optimized functions in React components (from things like unknown array map functions).
Closes https://github.com/facebook/prepack/pull/2054

Differential Revision: D8202653

Pulled By: trueadm

fbshipit-source-id: 9ea95720e5296e602068ca4fe111ab303b8b24fc
2018-05-30 14:32:13 -07:00
Dominic Gannaway
fdc7ba549f Cleanup of all the React reconciler logic + remove mutations on ReactElements
Summary:
Release notes: none

This PR is a general spring cleaning of all the React logic. Nothing is fixed, but the logic for many of the aspects of the React reconciliation have been simplified and tidied up.

- I've removed all cases of mutating ReactElements, we now create new ReactElements instead of mutating – because, well, ReactElements are immutable (as are props).
- Removed ReactSerializerState and moved the logic that previous existed into `realm.react`.
- Simplified the branching logic of the reconciler so we no longer need to pass around state and instead use the existing conditional logic.

Manually tested on all our internal bundles are we have no failures.
Closes https://github.com/facebook/prepack/pull/2039

Reviewed By: gaearon

Differential Revision: D8205619

Pulled By: trueadm

fbshipit-source-id: a84c363038086b490d761dbe18711d617058f05c
2018-05-30 12:39:22 -07:00
Dominic Gannaway
bd29f451fd Tidy up simple tests and fix refuseSerialization bug
Summary:
Release note: none

This PR remove `firstRenderOnly` from a bunch of tests that shouldn't have had it and adds a new test for a big with `props` being incorrectly marked for `refuseSerialization` – `props` can be serialialized without the ReactElement, and the test shows how this might happen.
Closes https://github.com/facebook/prepack/pull/2057

Differential Revision: D8203483

Pulled By: gaearon

fbshipit-source-id: fbfb9cc3bbdadaba5884f87319cb5b54e4a0657a
2018-05-30 10:49:05 -07:00
Dan Abramov
f55285012e Back out "[prepack][PR] Support call expressions where the base might be an abstract conditional"
Summary: It caused some regressions but we're not sure why. Need to increase test coverage first. Reverting for now.

Reviewed By: trueadm

Differential Revision: D8205062

fbshipit-source-id: fe03f8ea9e8c3d85b3ce96912c5135019f407a56
2018-05-30 09:45:00 -07:00
Dominic Gannaway
24181252fe Support call expressions where the base might be an abstract conditional
Summary:
Release notes: support call expressions where the base might be an abstract conditional

This PR is a follow up on a TODO I left in last week. We currently don't fully use the power of Prepack  around abstract conditional function calls. This adds support for them when calling NativeFunctionValues. For example:

```js
function fn(a)  {
  var array = (a === null ? [1,2,3] : [4,5,6]);

  return array.join("-");
}

global.__optimize && __optimize(fn);
```

Now becomes:

```js
  var _1 = function (a) {
    return a === null ? "1-2-3" : "4-5-6";
  };
```

Beforehand, it compiled to:

```js
  var _1 = function (a) {
    var _$0 = (a === null ? [1, 2, 3] : [4, 5, 6]).join("-");

    return _$0;
  };
```
Closes https://github.com/facebook/prepack/pull/2051

Differential Revision: D8201793

Pulled By: trueadm

fbshipit-source-id: c9a570ef9da844d84d0d5548b5c2d7b600dd4226
2018-05-30 04:10:08 -07:00
Herman Venter
26290ddd00 Fix lint errors
Summary:
Release note: none

Fix lint errors that came our way via an internal check in.
Closes https://github.com/facebook/prepack/pull/2052

Differential Revision: D8197681

Pulled By: hermanventer

fbshipit-source-id: fdc481228239dcc1eeafc904536188e25289162a
2018-05-29 17:48:22 -07:00
Herman Venter
3131aad4c1 Make ThrowCompletion constructor consistent with other completions
Summary:
Release note: Made ThrowCompletion constructor consistent with other completions

extractAndJoinCompletionsOfType assumes that all completions can be constructed by supplying only a value as parameter. ThrowCompletion needs to conform to this expectation.

This is a refactor towards some bug fixes where this matters. Test coverage will come with those fixes.
Closes https://github.com/facebook/prepack/pull/2050

Differential Revision: D8196790

Pulled By: hermanventer

fbshipit-source-id: d2eae166675d8835e8465b6db6f3856382dc59ba
2018-05-29 17:06:07 -07:00
Dan Abramov
5d45e5a7eb Fix test output
Summary: This ensures failing output for Prepack gets proxied into the actual logs in terminal and Sandcastle. That was the case for Jest, but not for Prepack itself. This surfaces the real error in D8188966, for example.

Reviewed By: sophiebits

Differential Revision: D8191668

fbshipit-source-id: d0e3e9ddc1f7b38157fc57a010026de9bb0ec79a
2018-05-29 14:39:17 -07:00
Nadav Kaner
45750d84ad remove verbose error when invariant level is zero
Summary:
Release Note: none

fix #1893
remove verbose error when invariant level is zero
Closes https://github.com/facebook/prepack/pull/2038

Differential Revision: D8180698

Pulled By: NTillmann

fbshipit-source-id: e0f9504ef84215292a9b4182d23d0898e7ef6c32
2018-05-28 16:56:15 -07:00
Nikolai Tillmann
459f3dc802 Mutations of final objects are not allowed.
Summary:
Release notes: None

This fixes #2040.
Adding regression error handler test.
Closes https://github.com/facebook/prepack/pull/2042

Differential Revision: D8180569

Pulled By: NTillmann

fbshipit-source-id: 2fd2dff79a8d78db91e8d089df44476083e66b89
2018-05-28 15:22:30 -07:00
Sapan Bhatia
2b9cd062fb Ignore .idea folder used by IntelliJ IDE
Summary:
Resolves #2046
Closes https://github.com/facebook/prepack/pull/2047

Differential Revision: D8180576

Pulled By: sb98052

fbshipit-source-id: d52fff4e4c43cbd5c86bb1ab650588cbf09e33ec
2018-05-28 15:22:30 -07:00