Skip to content

Commit

Permalink
WIP 6
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 22, 2023
1 parent efc78a9 commit 4da24c6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# TODO

* Handle setting `binding.isFrozenName` on `this` better. Better to set it, but just not to delete internal var trails? Actually I don't think it makes much odds. There's nowhere in a class constructor where `eval()` can go where it can't access `this$0`, and if `eval()` in nested function, `this$0` still needs to be frozen as it's in a scope above the `eval()`. So the implementation as is already optimal.
* 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.
* `serialize/blocks` + `serialize/functions` + `serialize/parseFunction` could have changes stripped out if so.
* TODO comment in `serialize/parseFunction`
* Tests
* Deal with duplicate bindings:
* Hoisted sloppy functions - actually no need, because `isFunction` means both are frozen anyway
* `for (let x of (() => x, [])) eval('x');` - done, but write test
* `function (x, _ = eval('x')) { var x; return x; }` - done (apart from `arguments`), but write test
* Tests
* Tests for binding in higher scope which is shadowed still not being renamed
e.g. `() => { let x = 1; { let x; eval('typeof a !== "undefined" && a = 2'); } return x; }` - make sure param `x` not renamed to `a`
* Make sure this includes vars which are illegal to access inside `eval()` if `eval()` is strict mode.
* Test for const violations with frozen vars when internal to function:

```js
module.exports = function(module, exports) {
const x = 1;
eval('x');
return () => { x = 2; };
};
```

Also where another binding which isn't frozen:

```js
module.exports = function(module, exports) {
const x = 1;
Expand Down

0 comments on commit 4da24c6

Please sign in to comment.