github.com/searKing/golang/go@v1.2.117/ast/ast.go (about) 1 // Copyright 2023 The searKing Author. 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 package ast 6 7 import "go/ast" 8 9 // Indirect returns the ast.Expr that x points to. 10 // If x is an ast.StarExpr, Indirect returns a zero ast.Expr. 11 // If x is not an ast.StarExpr, Indirect returns x. 12 func Indirect(x ast.Expr, d int) (ast.Expr, int) { 13 switch t := x.(type) { 14 case *ast.StarExpr: 15 return Indirect(t.X, d+1) 16 } 17 return x, d 18 }