Fix map polyfill to use a deterministic key for the hash

Summary:
Prepack does not understand how to use a random key as an object property. Instead, at build time, it generates a deterministic property name based on a deterministic seed for `Math.random()`.

Prepack would like to move away from this, and keep all the `Math.random()` unevaluated and left in the bundle.

Since this is the only usage of `Math.random()` that can't be handled by the abstract interpreter, it should be changed.

Note that the randomness is not required here at all, it just has to be *some* unique key.

Reviewed By: davidaurelio

Differential Revision: D9882757

fbshipit-source-id: 21c213db9716d2faeb8745d811a620b088a83781
This commit is contained in:
Riley Dulin 2018-09-17 14:54:21 -07:00 committed by Facebook Github Bot
parent d82b79870c
commit 85505fdd3e
1 changed files with 1 additions and 1 deletions

View File

@ -553,7 +553,7 @@ module.exports = (function(global, undefined) {
const getHash = (function() { const getHash = (function() {
const propIsEnumerable = Object.prototype.propertyIsEnumerable; const propIsEnumerable = Object.prototype.propertyIsEnumerable;
const hashProperty = guid(); const hashProperty = '__MAP_POLYFILL_INTERNAL_HASH__';
let hashCounter = 0; let hashCounter = 0;
/** /**