code: func GetVisitFn(visitorOpts *VisitorOptions, kind string, isLeaving bool) VisitFunc {
  	if visitorOpts == nil {
  		return nil
  	}
  	if kindVisitor, ok := visitorOpts.KindFuncMap[kind]; ok {
  		if !isLeaving && kindVisitor.Kind != nil {
  			// { Kind() {} }
  			return kindVisitor.Kind
  		} else if isLeaving {
  			// { Kind: { leave() {} } }
  			return kindVisitor.Leave
  		} else {
  			// { Kind: { enter() {} } }
  			return kindVisitor.Enter
  		}
  	}
  	if isLeaving {
  		// { leave() {} }
  		if genericVisitor := visitorOpts.Leave; genericVisitor != nil {
  			return genericVisitor
  		}
  		if specificKindVisitor, ok := visitorOpts.LeaveKindMap[kind]; ok {
  			// { leave: { Kind() {} } }
  			return specificKindVisitor
  		}
  
  	} else {
  		// { enter() {} }
  		if genericVisitor := visitorOpts.Enter; genericVisitor != nil {
  			return genericVisitor
  		}
  		if specificKindVisitor, ok := visitorOpts.EnterKindMap[kind]; ok {
  			// { enter: { Kind() {} } }
  			return specificKindVisitor
  		}
  	}
  	return nil
  }
docs: // GetVisitFn Given a visitor instance, if it is leaving or not, and a node kind, return
  // the function the visitor runtime should call.
  // priority [high->low] in VisitorOptions:
  // KindFuncMap{Kind> {Leave, Enter}} > {Leave, Enter} > {EnterKindMap, LeaveKindMap}