espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.76k stars 742 forks source link

`Object.defineProperty(<function>, ...)` #2501

Closed bobrippling closed 3 months ago

bobrippling commented 4 months ago

For debugging, I'd like to be able to do

Object.defineProperty(Bangle, ...)

At the moment I'm told it's because Bangle is not an object:

https://github.com/espruino/Espruino/blob/01467c2a539a737e2204af3f759348d0d1a7326e/src/jswrap_object.c#L601-L604

If it seems reasonable, I'll make a PR to adjust the check to permit functions - I believe this is ok to be done on all functions:

https://github.com/espruino/Espruino/blob/01467c2a539a737e2204af3f759348d0d1a7326e/src/jsvar.c#L206-L209

gfwilliams commented 4 months ago

Thanks! Yes, a PR for this would be good.