Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This commit allows for the creation of let/const bindings and ensures all block-scoped bindings are installed into the appropriate scope. This involves creating new LexScopes, as outlined in `test/bindings/scope.js`. Before this change, the environment stack, i.e., frames, changesets, and scopes, would change in lockstep. Now, lex scopes change separately from frames and changesets via `push_lex` and `pop_lex`. When adding heap refinements, we may traverse over lex scopes to find the scope where the base object was bound. In unusual cases, like try/catch, envs may have an uneven number of scopes when merging. The uneven scopes will always be lex. I have updated `merge_env` to accept this imbalance. Note that this is not a complete implementation of let/const: - [x] switch statements should forbid rebinding lexicals between cases - [x] functions, amazingly, are block scoped *and* hoisted in ES2015 - [ ] numerous TDZ cases, surely, which I have not yet investigated - [x] can't update cons Closes #784 Reviewed By: @jeffmo Differential Revision: D2428230 Pulled By: @bhosmer
- Loading branch information