visitAssignmentExpression: function()

in src/utils/resolveToValue.ts [77:102]


    visitAssignmentExpression: function (
      this: Context,
      path: NodePath<t.AssignmentExpression>,
    ): boolean | undefined {
      const node = path.node;
      // Skip anything that is not an assignment to a variable with the
      // passed name.
      // Ensure the LHS isn't the reference we're trying to resolve.
      if (
        !t.Identifier.check(node.left) ||
        node.left === idPath.node ||
        node.left.name !== name ||
        node.operator !== '='
      ) {
        return this.traverse(path);
      }
      // Ensure the RHS doesn't contain the reference we're trying to resolve.
      const candidatePath = path.get('right');
      for (let p = idPath; p && p.node != null; p = p.parent) {
        if (p.node === candidatePath.node) {
          return this.traverse(path);
        }
      }
      results.push(candidatePath);
      return false;
    },