Repository navigation
Redeclaring a variable counts as a modification - #6219
Conversation
|
@RubenVerborgh, thanks for your PR! By analyzing the history of the files in this pull request, we identified @kassens, @hzoo and @existentialism to be potential reviewers. |
jridgewell
left a comment
There was a problem hiding this comment.
This should have been fixed in #5745. I'd gladly accept the tests, though!
|
@jridgewell Woops, didn't find #5745 with issue search. Different keywords I guess. |
|
Actually, @jridgewell, could you have another look? The unit tests I added fail without my fix, and #5745 already made it to master. |
|
Oh, I see what it is. We didn't update |
|
Indeed, you just concat but don't update. I personally think the error is where I fixed it (incorrect assumption of a mapping key not existing yet), but I can migrate to the other fix. |
|
We can revert #5745 with this. Either's fine. |
| kind: kind, | ||
| }); | ||
| // A redeclaration of an existing variable is a modification | ||
| if (name in this.bindings) { |
There was a problem hiding this comment.
Actually, just check if (existing)
There was a problem hiding this comment.
if(this.hasOwnBinding(name)) works; can't do the second suggestion because no existing is in scope. How do I proceed?
There was a problem hiding this comment.
Check, works. Pushed new version.
|
Same with me. Maybe consider reopening #6217 until this is fixed? |
|
@jridgewell What should we do about this failure: https://travis-ci.org/babel/babel/jobs/273498334#L1073? Is the new version correct or not? |
|
Just update the test, the new output is fine. |
|
Made all the changes, tests pass. Now additionally removing unneeded code from #5745, keeping its tests. |
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/4839/ |
When a variable is redeclared (as in
var a = 1; var a = 2;), this PR ensures that the second declaration is no longer regarded as a constant.