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 this expression #150

Closed
wants to merge 3 commits into from
Closed

Implement this expression #150

wants to merge 3 commits into from

Conversation

sanxiyn
Copy link

@sanxiyn sanxiyn commented Oct 12, 2019

This is my first PR here!

After playing with boa for a while, I noticed this is unimplemented. I tried to implement it with as minimal changes as possible, so it may not fit the overall architecture. If so, just tell me how should I update.

@@ -60,6 +60,11 @@ pub trait EnvironmentRecordTrait: Debug + Trace + Finalize {
/// Return true if it does and false if it does not.
fn has_this_binding(&self) -> bool;

fn get_this_binding(&self) -> Value {
debug_assert!(self.has_this_binding());
Copy link
Member

Choose a reason for hiding this comment

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

not sure if the assert is needed?
It won't even compile if a has_this_binding() isn't implemented

Copy link
Author

Choose a reason for hiding this comment

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

has_this_binding can return false for some environment records, although the interpreter should never call get_this_binding for them. I am asserting that invariant here.

@jasonwilliams
Copy link
Member

jasonwilliams commented Oct 15, 2019

We already have this as just an identifier like any other, and we create it before entering a constructor function. How will your change deal with this, should that not be removed?

It would be good to see a test with constructors being used.
On the whole it makes sense though. Good work :D

@sanxiyn
Copy link
Author

sanxiyn commented Oct 15, 2019

Okay I will add a test with constructors.

@sanxiyn
Copy link
Author

sanxiyn commented Oct 23, 2019

Now with better understanding, I reimplemented this in #185.

@sanxiyn sanxiyn closed this Oct 23, 2019
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