Ensure abstract value has kind (#2349)

Summary:
Release notes: none

This gives a unique kind to the abstract value created by the React elements logic. Otherwise we hit this invariant, https://github.com/facebook/prepack/blob/master/src/utils/havoc.js#L493-L500 with our internal bundle. The abstract value in this case should have always had a kind given it has no args, values or types.
Pull Request resolved: https://github.com/facebook/prepack/pull/2349

Differential Revision: D9117711

Pulled By: trueadm

fbshipit-source-id: 1e41042f4747e5b990474d3356bf9627cde76374
This commit is contained in:
Dominic Gannaway 2018-08-01 07:35:34 -07:00 committed by Facebook Github Bot
parent 429852165d
commit f783183960

View File

@ -170,7 +170,13 @@ function createPropsObject(
// exist
for (let [propName, binding] of props.properties) {
if (binding.descriptor !== undefined && binding.descriptor.value === realm.intrinsics.undefined) {
hardModifyReactObjectPropertyBinding(realm, props, propName, AbstractValue.createFromType(realm, Value));
let kind = AbstractValue.makeKind("abstractCounted", (realm.objectCount++).toString()); // need not be an object, but must be unique
hardModifyReactObjectPropertyBinding(
realm,
props,
propName,
AbstractValue.createFromType(realm, Value, kind)
);
}
}
// if we have children and they are abstract, they might be undefined at runtime