How to use the esprima.Syntax.MemberExpression function in esprima

To help you get started, we’ve selected a few esprima 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 SAP / ui5-builder / lib / lbt / utils / ASTUtils.js View on Github external
function isNamedObject(node, objectPath, length) {
	// console.log("checking for named object ", node, objectPath, length);
	while ( length > 1
			&& node.type === Syntax.MemberExpression
			&& isIdentifier(node.property, objectPath[length-1]) ) {
		node = node.object;
		length--;
	}
	return length === 1 && isIdentifier(node, objectPath[0]);
}
github yanhaijing / template.js / packages / precompiler / src / index.ts View on Github external
currentContext.varList.push(getIdentifierName(node.id));
                    }
                    // @ts-ignore
                    currentContext.varList = currentContext.varList.concat(getParamsName(node.params));
                }
            }
            else if (type === Syntax.VariableDeclarator) {
                currentContext.varList = currentContext.varList.concat(getVariableDeclaratorName(node));
            } else if (type === Syntax.Identifier) {
                // todo check 是否在 context stack
                // @ts-ignore
                if (inContextStack(contextStack, node.name)) {
                    return;
                }
                // a.b b return
                if (parent.type === Syntax.MemberExpression && parent.object !== node) {
                    return;
                }

                const name = getIdentifierName(node);
                if (unVarList.indexOf(name) === -1) {
                    unVarList.push(name);
                }
            }
        },
        leave(node) {
github sophiebits / es3ify / index.js View on Github external
visitMemberExpression.test = function(node, path, state) {
    return node.type === Syntax.MemberExpression &&
        node.property.type === Syntax.Identifier &&
        reservedDict[node.property.name] === true;
};