Documentation ¶
Index ¶
- func As[T ast.Node](n ast.Node) (T, bool)
- func AsBasicLit(n ast.Node) (*ast.BasicLit, bool)
- func AsCompositeLit(n ast.Node) (*ast.CompositeLit, bool)
- func AsIdent(n ast.Node) (*ast.Ident, bool)
- func AsStarExpr(n ast.Node) (*ast.StarExpr, bool)
- func AsUnaryExpr(n ast.Node) (*ast.UnaryExpr, bool)
- func GetFuncName(fn *ast.FuncDecl) (string, bool)
- func InspectNode(i *Inspector, n ast.Node)
- func ParseFile(i *Inspector, p string) error
- func ParseString(i *Inspector, s string) error
- type CastExpr
- type FuncInfo
- type FuncRecv
- type FuncReturnCase
- type FuncReturnType
- type FuncReturns
- type Inspector
- type InspectorOptions
- type Listener
- type ReturnCaseType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsBasicLit ¶ added in v1.2.0
AsBasicLit casts an ast.Node to *ast.BasicLit
func AsCompositeLit ¶ added in v1.2.0
func AsCompositeLit(n ast.Node) (*ast.CompositeLit, bool)
AsCompositeLit casts an ast.Node to *ast.CompositeLit
func AsStarExpr ¶ added in v1.2.0
AsStarExpr casts an ast.Node to *ast.StarExpr
func AsUnaryExpr ¶ added in v1.2.0
AsUnaryExpr casts an ast.Node to *ast.UnaryExpr
func ParseString ¶
Types ¶
type CastExpr ¶ added in v1.2.0
func (*CastExpr) ToCompositeLit ¶ added in v1.2.0
func (c *CastExpr) ToCompositeLit() (*ast.CompositeLit, bool)
type FuncInfo ¶ added in v1.2.0
type FuncInfo struct { Name string Receivers []*FuncRecv Returns *FuncReturns }
func GetFuncInfo ¶ added in v1.2.0
type FuncReturnCase ¶ added in v1.2.0
type FuncReturnCase struct {
Results []*CastExpr
}
func GetFuncReturnCases ¶ added in v1.2.0
func GetFuncReturnCases(fn *ast.FuncDecl) ([]*FuncReturnCase, bool)
type FuncReturnType ¶ added in v1.2.0
func GetFuncReturnTypes ¶ added in v1.2.0
func GetFuncReturnTypes(fn *ast.FuncDecl) ([]*FuncReturnType, bool)
type FuncReturns ¶ added in v1.2.0
type FuncReturns struct { Types []*FuncReturnType ReturnCases []*FuncReturnCase }
type Inspector ¶
type Inspector struct { All listeners[ast.Node] ArrayType listeners[*ast.ArrayType] AssignStmt listeners[*ast.AssignStmt] BadDecl listeners[*ast.BadDecl] BadExpr listeners[*ast.BadExpr] BadStmt listeners[*ast.BadStmt] BasicLit listeners[*ast.BasicLit] BinaryExpr listeners[*ast.BinaryExpr] BlockStmt listeners[*ast.BlockStmt] BranchStmt listeners[*ast.BranchStmt] CallExpr listeners[*ast.CallExpr] CaseClause listeners[*ast.CaseClause] ChanType listeners[*ast.ChanType] CommClause listeners[*ast.CommClause] Comment listeners[*ast.Comment] CommentGroup listeners[*ast.CommentGroup] CompositeLit listeners[*ast.CompositeLit] DeclStmt listeners[*ast.DeclStmt] DeferStmt listeners[*ast.DeferStmt] Ellipsis listeners[*ast.Ellipsis] EmptyStmt listeners[*ast.EmptyStmt] ExprStmt listeners[*ast.ExprStmt] Field listeners[*ast.Field] FieldList listeners[*ast.FieldList] File listeners[*ast.File] ForStmt listeners[*ast.ForStmt] FuncDecl listeners[*ast.FuncDecl] FuncLit listeners[*ast.FuncLit] FuncType listeners[*ast.FuncType] GenDecl listeners[*ast.GenDecl] GoStmt listeners[*ast.GoStmt] Ident listeners[*ast.Ident] IfStmt listeners[*ast.IfStmt] ImportSpec listeners[*ast.ImportSpec] IncDecStmt listeners[*ast.IncDecStmt] IndexExpr listeners[*ast.IndexExpr] IndexListExpr listeners[*ast.IndexListExpr] InterfaceType listeners[*ast.InterfaceType] KeyValueExpr listeners[*ast.KeyValueExpr] LabeledStmt listeners[*ast.LabeledStmt] MapType listeners[*ast.MapType] ParenExpr listeners[*ast.ParenExpr] RangeStmt listeners[*ast.RangeStmt] ReturnStmt listeners[*ast.ReturnStmt] SelectStmt listeners[*ast.SelectStmt] SelectorExpr listeners[*ast.SelectorExpr] SendStmt listeners[*ast.SendStmt] SliceExpr listeners[*ast.SliceExpr] StarExpr listeners[*ast.StarExpr] StructType listeners[*ast.StructType] SwitchStmt listeners[*ast.SwitchStmt] TypeAssertExpr listeners[*ast.TypeAssertExpr] TypeSpec listeners[*ast.TypeSpec] TypeSwitchStmt listeners[*ast.TypeSwitchStmt] UnaryExpr listeners[*ast.UnaryExpr] ValueSpec listeners[*ast.ValueSpec] // contains filtered or unexported fields }
func NewInspector ¶
func NewInspector(ops *InspectorOptions) *Inspector
NewInspector creates a new Inspector pointer with the given options
type InspectorOptions ¶
type InspectorOptions struct {
AvoidNil bool
}
type ReturnCaseType ¶ added in v1.2.0
type ReturnCaseType int
Click to show internal directories.
Click to hide internal directories.