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 the "this" keyword #264

Closed
Razican opened this issue Feb 25, 2020 · 3 comments · Fixed by #320
Closed

Implement the "this" keyword #264

Razican opened this issue Feb 25, 2020 · 3 comments · Fixed by #320
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@Razican
Copy link
Member

Razican commented Feb 25, 2020

The this keyword returns an expression dependent on the context where it's being used. This context is resolved by the ResolveThisBinding() abstract operation. This abstract operation will get the current environment record, and return the this binding, if any.

The MDN documentation also explains how this keyword will resolve to a different expression depending on how it's called.

To implement this, we require changes to the parser, where keywords are parsed (parser.rs#L112), which will probably require a new ExprDef. Executing that expression in the executor, it should return the object representing the this binding.

@jasonwilliams jasonwilliams added the help wanted Extra attention is needed label Mar 4, 2020
@jasonwilliams
Copy link
Member

Thanks for making this

@Razican
Copy link
Member Author

Razican commented Mar 9, 2020

I just noticed that #185 exists.

@jasonwilliams
Copy link
Member

it does but its quite an old pr now

@Razican Razican added the enhancement New feature or request label Apr 3, 2020
@jasonwilliams jasonwilliams self-assigned this Apr 15, 2020
@Razican Razican linked a pull request May 7, 2020 that will close this issue
@Razican Razican mentioned this issue May 7, 2020
5 tasks
@jasonwilliams jasonwilliams added this to the v0.8.0 milestone May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants