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

Should check for existence of binding before creating a new one #19

Closed
jasonwilliams opened this issue May 28, 2019 · 2 comments
Closed
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@jasonwilliams
Copy link
Member

jasonwilliams commented May 28, 2019

Take this javascript..

let a = "foo";
a = "bar";

The error message we get is

thread 'main' panicked at 'Binding already exists!', src/lib/environment/global_environment_record.rs:108:13
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

This is because rather than re-using a the interpreter is attempting to create a new binding called a which already exists so causes an error.

https://github.com/jasonwilliams/boa/blob/master/src/lib/exec.rs#L333-L337 needs to be more clever. there needs to be a check here to see if the binding already exists, if it does use that binding and set it to a new value.

What does the spec say?

https://tc39.github.io/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
https://tc39.github.io/ecma262/#sec-putvalue

@jasonwilliams jasonwilliams added good first issue Good for newcomers help wanted Extra attention is needed labels May 28, 2019
@perfectmak
Copy link

@jasonwilliams is this still available, I would like to work on it to better understand how boa works

@jasonwilliams
Copy link
Member Author

Sure go for it @perfectmak

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 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants