Source file src/cmd/cgo/ast_go118.go
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 // +build !compiler_bootstrap 7 8 package main 9 10 import ( 11 "go/ast" 12 "go/token" 13 ) 14 15 func (f *File) walkUnexpected(x interface{}, context astContext, visit func(*File, interface{}, astContext)) { 16 switch n := x.(type) { 17 default: 18 error_(token.NoPos, "unexpected type %T in walk", x) 19 panic("unexpected type") 20 21 case *ast.IndexListExpr: 22 f.walk(&n.X, ctxExpr, visit) 23 f.walk(n.Indices, ctxExpr, visit) 24 } 25 } 26