Documentation ¶
Index ¶
- func AsAssignStmt(x ast.Node) *ast.AssignStmt
- func AsBinaryExpr(x ast.Node) *ast.BinaryExpr
- func AsBinaryExprOp(x ast.Node, op token.Token) *ast.BinaryExpr
- func AsCallExpr(x ast.Node) *ast.CallExpr
- func AsIdent(x ast.Node) *ast.Ident
- func AsParenExpr(x ast.Node) *ast.ParenExpr
- func AsSelectorExpr(x ast.Node) *ast.SelectorExpr
- func AsUnaryExpr(x ast.Node) *ast.UnaryExpr
- func AsUnaryExprOp(x ast.Node, op token.Token) *ast.UnaryExpr
- func IsNil(x ast.Node) bool
- func IsTypeExpr(info *types.Info, x ast.Expr) bool
- type AstSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsAssignStmt ¶
func AsAssignStmt(x ast.Node) *ast.AssignStmt
AsAssignStmt coerces x into non-nil assign stmt.
func AsBinaryExpr ¶
func AsBinaryExpr(x ast.Node) *ast.BinaryExpr
AsBinaryExpr coerces x into non-nil binary expr.
func AsBinaryExprOp ¶
AsBinaryExprOp is like AsBinaryExpr, but also checks for op token.
func AsCallExpr ¶
AsCallExpr coerces x into non-nil call expr.
func AsParenExpr ¶
AsParenExpr coerces x into non-nil paren expr.
func AsSelectorExpr ¶
func AsSelectorExpr(x ast.Node) *ast.SelectorExpr
AsSelectorExpr coerces x into non-nil selector expr.
func AsUnaryExpr ¶
AsUnaryExpr coerces x into non-nil unary expr.
func AsUnaryExprOp ¶
AsUnaryExprOp is like AsUnaryExpr, but also checks for op token.
func IsNil ¶
IsNil reports whether x is nil. Unlike simple nil check, also detects nil AST sentinels.
func IsTypeExpr ¶
IsTypeExpr reports whether x represents type expression.
Type expression does not evaluate to any run time value, but rather describes type that is used inside Go expression. For example, (*T)(v) is a CallExpr that "calls" (*T). (*T) is a type expression that tells Go compiler type v should be converted to.
Types ¶
type AstSet ¶
type AstSet struct {
// contains filtered or unexported fields
}
AstSet is a simple ast.Node set. Zero value is ready to use set. Can be reused after Clear call.