...

Package edge

import "cmd/vendor/golang.org/x/tools/go/ast/edge"
Overview
Index

Overview ▾

Package edge defines identifiers for each field of an ast.Node struct type that refers to another Node.

type Kind

A Kind describes a field of an ast.Node struct.

type Kind uint8
const (
    Invalid Kind = iota // for nodes at the root of the traversal

    ArrayType_Elt
    ArrayType_Len
    AssignStmt_Lhs
    AssignStmt_Rhs
    BinaryExpr_X
    BinaryExpr_Y
    BlockStmt_List
    BranchStmt_Label
    CallExpr_Args
    CallExpr_Fun
    CaseClause_Body
    CaseClause_List
    ChanType_Value
    CommClause_Body
    CommClause_Comm
    CommentGroup_List
    CompositeLit_Elts
    CompositeLit_Type
    DeclStmt_Decl
    DeferStmt_Call
    Ellipsis_Elt
    ExprStmt_X
    FieldList_List
    Field_Comment
    Field_Doc
    Field_Names
    Field_Tag
    Field_Type
    File_Decls
    File_Doc
    File_Name
    ForStmt_Body
    ForStmt_Cond
    ForStmt_Init
    ForStmt_Post
    FuncDecl_Body
    FuncDecl_Doc
    FuncDecl_Name
    FuncDecl_Recv
    FuncDecl_Type
    FuncLit_Body
    FuncLit_Type
    FuncType_Params
    FuncType_Results
    FuncType_TypeParams
    GenDecl_Doc
    GenDecl_Specs
    GoStmt_Call
    IfStmt_Body
    IfStmt_Cond
    IfStmt_Else
    IfStmt_Init
    ImportSpec_Comment
    ImportSpec_Doc
    ImportSpec_Name
    ImportSpec_Path
    IncDecStmt_X
    IndexExpr_Index
    IndexExpr_X
    IndexListExpr_Indices
    IndexListExpr_X
    InterfaceType_Methods
    KeyValueExpr_Key
    KeyValueExpr_Value
    LabeledStmt_Label
    LabeledStmt_Stmt
    MapType_Key
    MapType_Value
    ParenExpr_X
    RangeStmt_Body
    RangeStmt_Key
    RangeStmt_Value
    RangeStmt_X
    ReturnStmt_Results
    SelectStmt_Body
    SelectorExpr_Sel
    SelectorExpr_X
    SendStmt_Chan
    SendStmt_Value
    SliceExpr_High
    SliceExpr_Low
    SliceExpr_Max
    SliceExpr_X
    StarExpr_X
    StructType_Fields
    SwitchStmt_Body
    SwitchStmt_Init
    SwitchStmt_Tag
    TypeAssertExpr_Type
    TypeAssertExpr_X
    TypeSpec_Comment
    TypeSpec_Doc
    TypeSpec_Name
    TypeSpec_Type
    TypeSpec_TypeParams
    TypeSwitchStmt_Assign
    TypeSwitchStmt_Body
    TypeSwitchStmt_Init
    UnaryExpr_X
    ValueSpec_Comment
    ValueSpec_Doc
    ValueSpec_Names
    ValueSpec_Type
    ValueSpec_Values
)

func (Kind) FieldName

func (k Kind) FieldName() string

FieldName returns the name of the field.

func (Kind) FieldType

func (k Kind) FieldType() reflect.Type

FieldType returns the declared type of the field.

func (Kind) Get

func (k Kind) Get(n ast.Node, idx int) ast.Node

Get returns the direct child of n identified by (k, idx). n's type must match k.NodeType(). idx must be a valid slice index, or -1 for a non-slice.

func (Kind) NodeType

func (k Kind) NodeType() reflect.Type

NodeType returns the pointer-to-struct type of the ast.Node implementation.

func (Kind) String

func (k Kind) String() string

String returns a description of the edge kind.