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

TypeOf failing #359

Closed
jasonwilliams opened this issue May 1, 2020 · 5 comments · Fixed by #396
Closed

TypeOf failing #359

jasonwilliams opened this issue May 1, 2020 · 5 comments · Fixed by #396
Assignees
Labels
bug Something isn't working E-Easy Easy enhancement New feature or request good first issue Good for newcomers parser Issues surrounding the parser
Milestone

Comments

@jasonwilliams
Copy link
Member

jasonwilliams commented May 1, 2020

TypeOf is defined as both a Node:
https://github.com/jasonwilliams/boa/blob/master/boa/src/syntax/ast/node.rs#L421

And a UnaryOp Variant:
https://github.com/jasonwilliams/boa/blob/master/boa/src/syntax/parser/expression/unary.rs#L58-L60

looking at the spec it seems the former is what we should keep and we should remove it from being a unary variant.

Right now the variant is being used but there's no implementation on the exec side

Make some JS, like this to test.

const a = String();
typeof a;

I'm not sure we will need https://github.com/jasonwilliams/boa/blob/master/boa/src/builtins/value/mod.rs#L631-L651 once Node::TypeOf is being used.

Spec:
https://tc39.es/ecma262/#sec-typeof-operator

Debugging
https://github.com/jasonwilliams/boa/blob/master/docs/debugging.md

@jasonwilliams jasonwilliams added good first issue Good for newcomers E-Easy Easy parser Issues surrounding the parser labels May 1, 2020
@jasonwilliams jasonwilliams changed the title TypeOf duplication (Both a Node::TypeOf and a UnaryOp::TypeOf) TypeOf duplication (Node::TypeOf and UnaryOp::TypeOf) May 1, 2020
@jasonwilliams jasonwilliams changed the title TypeOf duplication (Node::TypeOf and UnaryOp::TypeOf) TypeOf failing May 1, 2020
@JavedNissar
Copy link
Contributor

JavedNissar commented May 8, 2020

I'm willing to take this on.

@Razican
Copy link
Member

Razican commented May 8, 2020

I'm willing to take this on.

Go ahead! Let us know if you need help!

@Razican
Copy link
Member

Razican commented May 13, 2020

looking at the spec it seems the former is what we should keep and we should remove it from being a unary variant.

How do we decide this? Looking at the spec, it does seem indeed to be a unary operator, right?

@jasonwilliams
Copy link
Member Author

looking at the spec it seems the former is what we should keep and we should remove it from being a unary variant.

How do we decide this? Looking at the spec, it does seem indeed to be a unary operator, right?

You’re right now I see it’s a unary expression

@Razican
Copy link
Member

Razican commented May 13, 2020

You’re right now I see it’s a unary expression

In this case, I think it's best to implement it as a unary expression and remove the Node.

@Razican Razican added bug Something isn't working enhancement New feature or request labels May 13, 2020
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 13, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 13, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 14, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 14, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 14, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
@Razican Razican added this to the v0.8.0 milestone May 14, 2020
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 15, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 16, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 18, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 18, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 19, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
JavedNissar added a commit to JavedNissar/boa that referenced this issue May 21, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
Razican pushed a commit that referenced this issue May 21, 2020
Removed Node::TypeOf, implemented UnaryOp::TypeOf, and added tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working E-Easy Easy enhancement New feature or request good first issue Good for newcomers parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants