Black Lives Matter. Support the Equal Justice Initiative.

Source file src/go/ast/walk_typeparams.go

Documentation: go/ast

     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 typeparams
     6  // +build typeparams
     7  
     8  package ast
     9  
    10  import (
    11  	"fmt"
    12  )
    13  
    14  func walkFuncTypeParams(v Visitor, n *FuncType) {
    15  	if n.TParams != nil {
    16  		Walk(v, n.TParams)
    17  	}
    18  }
    19  
    20  func walkTypeSpecParams(v Visitor, n *TypeSpec) {
    21  	if n.TParams != nil {
    22  		Walk(v, n.TParams)
    23  	}
    24  }
    25  
    26  func walkOtherNodes(v Visitor, n Node) {
    27  	if e, ok := n.(*ListExpr); ok {
    28  		if e != nil {
    29  			for _, elem := range e.ElemList {
    30  				Walk(v, elem)
    31  			}
    32  		}
    33  	} else {
    34  		panic(fmt.Sprintf("ast.Walk: unexpected node type %T", n))
    35  	}
    36  }
    37  

View as plain text