react icon indicating copy to clipboard operation
react copied to clipboard

compiler: add built-in Object.prototype methods to ShapeRegistry

Open saul-atomrigs opened this issue 7 months ago • 4 comments

This PR enhances the ShapeRegistry by incorporating additional Object.prototype methods from the TODO. In this implementation:

  • toLocaleString is similar to the existing toString method: it takes no arguments and returns a primitive value (string).
  • hasOwnProperty, isPrototypeOf, and propertyIsEnumerable all take one argument and return a primitive (boolean).
  • valueOf takes no arguments and returns a poly type(the this value, converted to an object.).

References:

  • toLocaleString: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString
  • hasOwnProperty: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
  • isPrototypeOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf
  • propertyIsEnumerable: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable
  • valueOf: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf

saul-atomrigs avatar Jun 26 '24 17:06 saul-atomrigs