Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Remove errant ToPrimitive #163

Merged
merged 1 commit into from
Nov 2, 2018
Merged

Conversation

littledan
Copy link
Member

Looks like this ToPrimitive call is a relic from back when PrivateName
was a primitive type. Now that it's an object, and toString() throws,
the result would be that an exception would be thrown on this line.
Furthermore, it's redundant given the following ToPropertyKey call.
This patch simply removes the ToPrimitive operation.

Looks like this ToPrimitive call is a relic from back when PrivateName
was a primitive type. Now that it's an object, and toString() throws,
the result would be that an exception would be thrown on this line.
Furthermore, it's redundant given the following ToPropertyKey call.
This patch simply removes the ToPrimitive operation.
@littledan
Copy link
Member Author

cc @nicolo-ribaudo

@@ -783,7 +783,6 @@ <h1>ToElementDescriptor ( _elementObject_ )</h1>
1. Let _kind_ be ? ToString(? Get(_elementObject_, `"kind"`)).
1. If _kind_ is not one of `"method"` or `"field"`, throw a *TypeError* exception.
1. Let _key_ be ? Get(_elementObject_, `"key"`).
1. Set _key_ to ? ToPrimitive(_key_, hint String).
1. If _key_ has a [[PrivateName]] internal slot, set _key_ to _key_.[[PrivateName]].
1. Otherwise, set _key_ to ? ToPropertyKey(_key_).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Note for anyone reading this PR)

ToPropertyKey calls ToPrimitive

@littledan
Copy link
Member Author

I haven't heard any concerns about this bug fix, so merging.

@littledan littledan merged commit df52fa4 into master Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants