code: func matchRefPath(expr syntax.Expr) (path []string) {
  loop:
  	for {
  		switch next := expr.(type) {
  		case *syntax.DotExpr: // next in chain
  			path = append(path, next.Name.Name)
  			expr = next.X
  		case *syntax.Ident: // last in chain
  			path = append(path, next.Name)
  			break loop
  		default:
  			return nil // not a simple ref path, has additional structure, give up
  		}
  	}
  	// Expr "a.b.c" results in ['c', 'b', 'a'], reverse.
  	for l, r := 0, len(path)-1; l < r; l, r = l+1, r-1 {
  		path[l], path[r] = path[r], path[l]
  	}
  	return
  }
docs: // matchRefPath matches an <Expr> to <Ident>(.<Ident>)* returning identifier'
  // names as a list of strings.