lib/hash.js
function hashcons(node) {
  const keys = t.VISITOR_KEYS[node.type];
  if (!keys) return;

  let hash = hashcode(node);

  for (const key of keys) {
    const subNode = node[key];

    if (Array.isArray(subNode)) {
      for (const child of subNode) {
        if (child) {
          hash += hashcons(child);
        }
      }
    } else if (subNode) {
      hash += hashcons(subNode);
    }
  }

  return hash;
}
function hashcons(node) {
  const keys = t.VISITOR_KEYS[node.type];
  if (!keys) return;

  let hash = hashcode(node);

  for (const key of keys) {
    const subNode = node[key];

    if (Array.isArray(subNode)) {
      for (const child of subNode) {
        if (child) {
          hash += hashcons(child);
        }
      }
    } else if (subNode) {
      hash += hashcons(subNode);
    }
  }

  return hash;
}
function hashcons ( node ) { const keys = t . VISITOR_KEYS [ node . type ] ; if ( ! keys ) return ; let hash = hashcode ( node ) ; for ( const key of keys ) { const subNode = node [ key ] ; if ( Array . isArray ( subNode ) ) { for ( const child of subNode ) { if ( child ) { hash += hashcons ( child ) ; } } } else if ( subNode ) { hash += hashcons ( subNode ) ; } } return hash ; }
Hashconsing - return the hash of an ASTNode computed recursively

@param {ASTNode} node
Hashconsing - return the hash of an ASTNode computed recursively