tvcutsem/harmony-reflect

'Illegal access' error when using Object.assign()

zvchei opened this issue · 1 comments

I am using harmony-reflect@1.4.5 and node v4.2.6

Running the following code throws the error:

> const a = { some: 'object' }
> const p = new Proxy(a, {})
> Object.assign({}, a)
illegal access

It appears the new ES6 Object.assign built-in does not like being applied to harmony-era proxy objects. My fix is to polyfill Object.assign such that when any of the arguments passed to Object.assign is a Proxy, I use the polyfill defined here. When no argument is a proxy, I use the built-in version of Object.assign.

Will soon publish as reflect@1.4.6.