code: function forEachMapping(ast: Ast, pushMapping: RangeMapping => void) {
    const nameStack = [];
    let tailPos = {line: 1, column: 0};
    let tailName = null;
  
    function advanceToPos(pos) {
      if (tailPos && positionGreater(pos, tailPos)) {
        const name = nameStack[0].name; // We always have at least Program
        if (name !== tailName) {
          pushMapping({
            name,
            start: {line: tailPos.line, column: tailPos.column},
          });
          tailName = name;
        }
      }
      tailPos = pos;
    }
  
    function pushFrame(name, loc) {
      advanceToPos(loc.start);
      nameStack.unshift({name, loc});
    }
  
    function popFrame() {
      const top = nameStack[0];
      if (top) {
        const {loc} = top;
        advanceToPos(loc.end);
        nameStack.shift();
      }
    }
  
    traverse(ast, {
      'Function|Program': {
        enter(path) {
          pushFrame(getNameForPath(path), path.node.loc);
        },
        exit(path) {
          popFrame();
        },
      },
    });
  }
docs: Traverses a Babel AST and calls the supplied callback with function name
  mappings, one at a time.