Cannot use Symbol as key in computed key accessor property: var x = {get [Symbol()](){ /* some code */ }}
#1614
Labels
bug
Issues considered a bug
Ecma Incompatibility
Issues about Rhino being incompatible with the EcmaScript spec
See #1610 (comment)
I locally fixed it by patching ScriptRuntime.newObjectLiteral(...) by adding a check for Symbol and following a different codepath:
In the
id instanceof Symbol
branch, I'm calling defineOwnProperty, whereas for all other type of keys it uses setGetterOrSetter, which is tailored to handling just String and int keys and directly modifies the slot mapUsing defineOwnProperty however requires to instantiate a descriptor ScriptableObject, which then follows a different path to modify the slot map.
Thoughts on this approach? Feels a bit messy to me, so like to get some other opinions @gbrail @rbri @andreabergia
The text was updated successfully, but these errors were encountered: