Skip to content

Commit

Permalink
TODO comments [nocode]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jul 8, 2023
1 parent 6476382 commit 7c89c98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/instrument/modify.js
Expand Up @@ -273,6 +273,7 @@ function insertImportStatement(programNode, state) {
// = require('/path/to/app/node_modules/livepack/lib/init/index.js')
// ('/path/to/app/file.js', module, require, 100, 0);
// ```
// TODO: Make this just a direct call if no `livepack_tracker` and `livepack_getScopeId` vars required
const statementNode = t.variableDeclaration(
'const', [
t.variableDeclarator(
Expand Down
4 changes: 4 additions & 0 deletions lib/instrument/visitors/eval.js
Expand Up @@ -110,6 +110,9 @@ function instrumentEvalCall(
// This is relevant as it affects whether var is flagged as mutable or not.
const isConst = binding.isConst || (isStrict && (varName === 'arguments' || varName === 'eval'));
const varDefNodes = [t.stringLiteral(varName)];
// TODO: Can `binding.isSilentConst` be true when `isConst` is false?
// If so, this is a bug.
// If not, then `if (binding.isSilentConst)` could go inside `if (isConst)` block.
if (isConst) varDefNodes.push(t.numericLiteral(1));
if (binding.isSilentConst) varDefNodes.push(t.numericLiteral(1));
if (binding.argNames) {
Expand Down Expand Up @@ -281,6 +284,7 @@ function activateSuperIfIsUsable(fn, superBlock, thisBlock, superIsProto, trail,
createExternalVarForThis(fn, thisBlock, state);
} else if (fnType === 'ClassDeclaration' || fnType === 'ClassExpression') {
if (trail.length > 6) {
// TODO: I'm not sure this is correct - I think doesn't apply in `ClassMethod`s?
const maybeConstructorNode = getProp(fn.node, trail, 3);
if (maybeConstructorNode.type === 'ClassMethod' && maybeConstructorNode.kind === 'constructor') {
// In class constructor - need internal var for `this` as `eval()` code might include `super()`
Expand Down

0 comments on commit 7c89c98

Please sign in to comment.