1// Copyright 2021 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5//go:build !compiler_bootstrap
6
7package main
8
9import (
10	"go/ast"
11	"go/token"
12)
13
14func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) {
15	switch n := x.(type) {
16	default:
17		error_(token.NoPos, "unexpected type %T in walk", x)
18		panic("unexpected type")
19
20	case *ast.IndexListExpr:
21		f.walk(&n.X, ctxExpr, visit)
22		f.walk(n.Indices, ctxExpr, visit)
23	}
24}
25
26func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
27	return n.TypeParams
28}
29
30func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
31	return n.TypeParams
32}
33