How to use the esotope-hammerhead.Syntax.NewExpression 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-get.ts View on Github external
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)
            return false;

        // new (object[prop])() || new (object[prop])
        if (parent.type === Syntax.NewExpression && parent.callee === node)
            return false;

        // for(object[prop] in source)
        if (parent.type === Syntax.ForInStatement && parent.left === node)
            return false;

        return true;
    },
github DevExpress / testcafe-hammerhead / src / processing / script / transformers / property-get.ts View on Github external
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 === '--')
            return false;

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

        // Skip: for(object.prop in source)
        if (parent.type === Syntax.ForInStatement && parent.left === node)
            return false;

        return true;
    },
github DevExpress / testcafe-hammerhead / src / processing / script / transform.ts View on Github external
static create (currState: State, node: Node, parent?: T, key?: keyof T, hasTransformedAncestor: boolean = false): State {
        const isNewExpression         = node.type === Syntax.NewExpression;
        const isNewExpressionAncestor = isNewExpression && !currState.newExpressionAncestor;
        const newState                = new State();

        newState.hasTransformedAncestor      = currState.hasTransformedAncestor || hasTransformedAncestor;
        newState.newExpressionAncestor       = isNewExpressionAncestor ? node : currState.newExpressionAncestor;
        newState.newExpressionAncestorParent = isNewExpressionAncestor ? parent : currState.newExpressionAncestorParent;
        // @ts-ignore
        newState.newExpressionAncestorKey    = isNewExpressionAncestor ? key : currState.newExpressionAncestorKey;

        return newState;
    }
}