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

Create Number object #34

Closed
jasonwilliams opened this issue Jun 28, 2019 · 4 comments
Closed

Create Number object #34

jasonwilliams opened this issue Jun 28, 2019 · 4 comments
Assignees
Labels
good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com

Comments

@jasonwilliams
Copy link
Member

jasonwilliams commented Jun 28, 2019

You can look at how String is created, here:
https://github.com/jasonwilliams/boa/blob/master/src/lib/js/string.rs

boolean
https://github.com/jasonwilliams/boa/blob/master/src/lib/js/boolean.rs

Its then added to the global scope here:
https://github.com/jasonwilliams/boa/blob/master/src/lib/exec.rs#L36

@jasonwilliams jasonwilliams added good first issue Good for newcomers and removed good first issue Good for newcomers labels Jun 29, 2019
@jasonwilliams jasonwilliams added good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Sep 3, 2019
@pop
Copy link
Contributor

pop commented Sep 26, 2019

This sounds cool and I'm interested in contributing to Boa for Hacktoberfest. Mind if I start working on this?

@jasonwilliams
Copy link
Member Author

@pop assigned

pop added a commit to pop/boa that referenced this issue Oct 9, 2019
pop added a commit to pop/boa that referenced this issue Oct 9, 2019
@pop
Copy link
Contributor

pop commented Oct 9, 2019

@jasonwilliams I've got most of the skeleton code up on my fork of boa (HERE).

I'm not sure what you mean by how we should add the new Number object to the global scope.

There already seems to be some kind of Number in boa, but not a proper Number object.

Any hints?

pop added a commit to pop/boa that referenced this issue Oct 16, 2019
pop added a commit to pop/boa that referenced this issue Oct 16, 2019
@jasonwilliams
Copy link
Member Author

@pop sorry i thought i replied to this.
We add Globals here:https://github.com/jasonwilliams/boa/blob/master/src/lib/realm.rs#L58-L65
So just look at how the others work

pop added a commit to pop/boa that referenced this issue Oct 22, 2019
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()

Missing:
- Number().toPrecision()

refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 22, 2019
pop added a commit to pop/boa that referenced this issue Oct 22, 2019
pop added a commit to pop/boa that referenced this issue Oct 22, 2019
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()

Missing:
- Number().toPrecision()

refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 22, 2019
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()

Missing:
- Number().toPrecision()

refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()

Missing:
- Number().toPrecision()

refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
I don't have all the context on _why_ but all of the tests for `Number` started failing.

Upon investigation it was becuase `const` stopped acting the way I expected.
Switching my test cases from using `const` to using `var` variable declarations
made everything work again.  I don't know enough about JS to know if this is a
bug or expected behavior.  Based on changes to other tests, it is know
behavior.

Refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
Includes some clippy fixes.

Fixes boa-dev#34
pop added a commit to pop/boa that referenced this issue Oct 27, 2019
Includes some clippy fixes.

Fixes boa-dev#34
pop added a commit to pop/boa that referenced this issue Nov 5, 2019
pop added a commit to pop/boa that referenced this issue Nov 5, 2019
pop added a commit to pop/boa that referenced this issue Nov 5, 2019
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()

Missing:
- Number().toPrecision()

refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Nov 5, 2019
I don't have all the context on _why_ but all of the tests for `Number` started failing.

Upon investigation it was becuase `const` stopped acting the way I expected.
Switching my test cases from using `const` to using `var` variable declarations
made everything work again.  I don't know enough about JS to know if this is a
bug or expected behavior.  Based on changes to other tests, it is know
behavior.

Refs boa-dev#34
pop added a commit to pop/boa that referenced this issue Nov 5, 2019
Includes some clippy fixes.

Fixes boa-dev#34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Projects
None yet
Development

No branches or pull requests

2 participants