Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Skip: const postMessage = value;
if (parent.type === Syntax.VariableDeclarator && parent.id === node)
return false;
// Skip: postMessage++ || postMessage-- || ++postMessage || --postMessage
if (parent.type === Syntax.UpdateExpression && (parent.operator === '++' || parent.operator === '--'))
return false;
// Skip already transformed: __get$PostMessage(postMessage) || __call$(obj, postMessage, args...);
if (parent.type === Syntax.CallExpression && parent.callee.type === Syntax.Identifier &&
(parent.callee.name === INSTRUCTION.getPostMessage ||
parent.callee.name === INSTRUCTION.callMethod && parent.arguments[1] === node))
return false;
// Skip: function x (...postMessage) {}
if (parent.type === Syntax.RestElement)
return false;
return true;
},
// Skip already transformed: __get$Loc(location)
if (parent.type === Syntax.CallExpression && parent.callee.type === Syntax.Identifier &&
parent.callee.name === INSTRUCTION.getLocation)
return false;
// Skip: class X { location () {} }
if (parent.type === Syntax.MethodDefinition)
return false;
// Skip: class location { x () {} }
if (parent.type === Syntax.ClassDeclaration)
return false;
// Skip: function x (...location) {}
if (parent.type === Syntax.RestElement)
return false;
return true;
},
// Skip: const eval = value;
if (parent.type === Syntax.VariableDeclarator && parent.id === node)
return false;
// Skip: eval++ || eval-- || ++eval || --eval
if (parent.type === Syntax.UpdateExpression && (parent.operator === '++' || parent.operator === '--'))
return false;
// Skip already transformed: __get$Eval(eval)
if (parent.type === Syntax.CallExpression && parent.callee.type === Syntax.Identifier &&
parent.callee.name === INSTRUCTION.getEval)
return false;
// Skip: function x (...eval) {}
if (parent.type === Syntax.RestElement)
return false;
return true;
}
return false;
},