Skip to content

Commit

Permalink
WIP 2
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 20, 2023
1 parent 8d33650 commit 570b45e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

* Blocks in serializer code rename internal vars which aren't frozen, even in prescence of `eval()`
* No point setting `isFrozenName` on external vars passed to serializer? (as it depends entirely on `containsEval` anyway)
* Right now, it is pointless, but in future when scope tree is built dynamically, it would allow
pulling vars which aren't accessible by `eval()` up to a higher level in the tree so they can be renamed.
* Problem with accurately flagging `super` and `new.target` external vars as `isFrozenName`
because `eval()` doesn't create external vars for them - maybe could do that in 2nd pass.
* `serialize/blocks` + `serialize/functions` + `serialize/parseFunction` could have changes stripped out if so.
* TODO comment in `visitors/eval`
* TODO comment in `serialize/blocks`
Expand Down
3 changes: 2 additions & 1 deletion lib/instrument/visitors/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ function instrumentEvalCall(callNode, block, fn, isStrict, canUseSuper, superIsP
if (!isConst) externalVar.isAssignedTo = true;
if (!externalVar.isFrozenName) {
// TODO: Should also do same for all functions above
// TODO: Should also do this for `super` and `new.target`
// TODO: Should also set `isFrozenName` for `super` and `new.target`,
// but it may be too early to do that if `eval()` is before `super` / `new.target`.
externalVar.isFrozenName = true;
externalVar.trails.length = 0;
}
Expand Down

0 comments on commit 570b45e

Please sign in to comment.