function getTopAssignment(leafNode) {
    let node = leafNode

    // Skip MemberExpressions.
    while (
        node.parent.type === "MemberExpression" &&
        node.parent.object === node
    ) {
        node = node.parent
    }

    // Check assignments.
    if (!isAssignee(node)) {
        return null
    }

    // Find the top.
    while (node.parent.type === "AssignmentExpression") {
        node = node.parent
    }

    return node
}
function getTopAssignment(leafNode) {
    let node = leafNode

    
    while (
        node.parent.type === "MemberExpression" &&
        node.parent.object === node
    ) {
        node = node.parent
    }

    
    if (!isAssignee(node)) {
        return null
    }

    
    while (node.parent.type === "AssignmentExpression") {
        node = node.parent
    }

    return node
}
function getTopAssignment ( leafNode ) { let node = leafNode // Skip MemberExpressions. while ( node . parent . type === "MemberExpression" && node . parent . object === node ) { node = node . parent } // Check assignments. if ( ! isAssignee ( node ) ) { return null } // Find the top. while ( node . parent . type === "AssignmentExpression" ) { node = node . parent } return node }
Gets the top assignment expression node if the given node is an assignee.

This is used to distinguish 2 assignees belong to the same assignment.
If the node is not an assignee, this returns null.

@param {ASTNode} leafNode - The node to get.
@returns {ASTNode|null} The top assignment expression node, or null.
Gets the top assignment expression node if the given node is an assignee .