diff --git a/TODO.md b/TODO.md index 70192269..23bc664d 100644 --- a/TODO.md +++ b/TODO.md @@ -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` diff --git a/lib/instrument/visitors/eval.js b/lib/instrument/visitors/eval.js index 1febbb65..d57da0fc 100644 --- a/lib/instrument/visitors/eval.js +++ b/lib/instrument/visitors/eval.js @@ -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; }