How to use the esotope-hammerhead.Syntax.Super function in esotope-hammerhead

To help you get started, we’ve selected a few esotope-hammerhead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe-hammerhead / src / processing / script / transformers / computed-property-set.ts View on Github external
condition: node => {
        const left = node.left;

        // super[prop] = value
        if (left.type === Syntax.MemberExpression && left.object.type === Syntax.Super)
            return false;

        if (node.operator === '=' && left.type === Syntax.MemberExpression && left.computed)
            return left.property.type === Syntax.Literal ? shouldInstrumentProperty(left.property.value) : true;

        return false;
    },
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / property-set.ts View on Github external
condition: node => {
        // super.prop = value
        if (node.left.type === Syntax.MemberExpression && node.left.object.type === Syntax.Super)
            return false;

        return node.operator === '=' &&
               node.left.type === Syntax.MemberExpression && !node.left.computed &&
               node.left.property.type === Syntax.Identifier &&
               shouldInstrumentProperty(node.left.property.name);
    },
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / computed-property-get.ts View on Github external
condition: (node, parent) => {
        if (!node.computed)
            return false;

        if (node.property.type === Syntax.Literal && !shouldInstrumentProperty(node.property.value))
            return false;

        // super[prop]
        if (node.object.type === Syntax.Super)
            return false;

        // object[prop] = value
        if (parent.type === Syntax.AssignmentExpression && parent.left === node)
            return false;

        // delete object[prop]
        if (parent.type === Syntax.UnaryExpression && parent.operator === 'delete')
            return false;

        // object[prop]++ || object[prop]-- || ++object[prop] || --object[prop]
        if (parent.type === Syntax.UpdateExpression && parent.operator === '++' || parent.operator === '--')
            return false;

        // object[prop]()
        if (parent.type === Syntax.CallExpression && parent.callee === node)
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / property-get.ts View on Github external
condition: (node, parent) => {
        if (node.computed)
            return false;

        if (!shouldInstrumentProperty(node.property.name))
            return false;

        // Skip: super.prop
        if (node.object.type === Syntax.Super)
            return false;

        // Skip: object.prop = value
        if (parent.type === Syntax.AssignmentExpression && parent.left === node)
            return false;

        // Skip: delete object.prop
        if (parent.type === Syntax.UnaryExpression && parent.operator === 'delete')
            return false;

        // Skip: object.prop()
        if (parent.type === Syntax.CallExpression && parent.callee === node)
            return false;

        // Skip: object.prop++ || object.prop-- || ++object.prop || --object.prop
        if (parent.type === Syntax.UpdateExpression && parent.operator === '++' || parent.operator === '--')