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

Implement Symbol.prototype.valueOf #1618

Merged
merged 2 commits into from
Oct 3, 2021
Merged

Implement Symbol.prototype.valueOf #1618

merged 2 commits into from
Oct 3, 2021

Conversation

hle0
Copy link
Contributor

@hle0 hle0 commented Oct 3, 2021

Signed-off-by: hle0 91701075+hle0@users.noreply.github.com

This Pull Request fixes/closes #1617 .

It changes the following:

  • valueOf is defined differently for Symbol so that Symbol('s').valueOf() == Symbol('s'), as per the spec.

Signed-off-by: hle0 <91701075+hle0@users.noreply.github.com>
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Just a small detail. Everything else looks good!

Comment on lines 231 to 233
// valueOf a symbol is itself
let symbol = Self::this_symbol_value(this, context)?;
Ok(JsValue::Symbol(symbol))
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment with the spec steps? Even if it's only a single one :)

@jedel1043 jedel1043 added bug Something isn't working builtins PRs and Issues related to builtins/intrinsics labels Oct 3, 2021
@jedel1043 jedel1043 added this to the v0.14.0 milestone Oct 3, 2021
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Good work! We require two approved reviews to merge into master, so in a bit of time this should get merged :)

@jedel1043 jedel1043 changed the title fix Symbol.prototype.valueOf (#1617) fix Symbol.prototype.valueOf Oct 3, 2021
@jedel1043 jedel1043 changed the title fix Symbol.prototype.valueOf Fix Symbol.prototype.valueOf Oct 3, 2021
@jedel1043 jedel1043 changed the title Fix Symbol.prototype.valueOf Implement Symbol.prototype.valueOf Oct 3, 2021
@HalidOdat HalidOdat merged commit d3c5aea into boa-dev:master Oct 3, 2021
@jedel1043 jedel1043 added enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com and removed bug Something isn't working labels Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Symbol.prototype.valueOf.call(x) gives different results than x.valueOf()
3 participants