Skip to content

Commit

Permalink
with statements WIP 2
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Sep 6, 2023
1 parent 044f5c2 commit fb95cfa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/serialize/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,19 @@ module.exports = {
} else if (withVarName) {
// Wrap in `{ with (with$0) return ...; }`.
// NB: It's not possible for the `with` object to be a circular reference.
// TODO: But it can have circular properties:
// `
// const o = {};
// let f, f2;
// with (o) {
// let y;
// f = () => x;
// f2 = () => [x, y];
// }
// o.x = f;
// o.x2 = f2;
// module.exports = f;
// `
returnNode = t.blockStatement([
t.withStatement(t.identifier(withVarName), t.returnStatement(returnNode))
]);
Expand Down

0 comments on commit fb95cfa

Please sign in to comment.