lintutil

package
v0.0.0-...-97246d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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

func AsBinaryExprOp(x ast.Node, op token.Token) *ast.BinaryExpr

AsBinaryExprOp is like AsBinaryExpr, but also checks for op token.

func AsCallExpr

func AsCallExpr(x ast.Node) *ast.CallExpr

AsCallExpr coerces x into non-nil call expr.

func AsIdent

func AsIdent(x ast.Node) *ast.Ident

AsIdent coerces x into non-nil ident.

func AsParenExpr

func AsParenExpr(x ast.Node) *ast.ParenExpr

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

func AsUnaryExpr(x ast.Node) *ast.UnaryExpr

AsUnaryExpr coerces x into non-nil unary expr.

func AsUnaryExprOp

func AsUnaryExprOp(x ast.Node, op token.Token) *ast.UnaryExpr

AsUnaryExprOp is like AsUnaryExpr, but also checks for op token.

func IsNil

func IsNil(x ast.Node) bool

IsNil reports whether x is nil. Unlike simple nil check, also detects nil AST sentinels.

func IsTypeExpr

func IsTypeExpr(info *types.Info, x ast.Expr) bool

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.

func (*AstSet) Clear

func (s *AstSet) Clear()

Clear removes all element from set.

func (*AstSet) Contains

func (s *AstSet) Contains(x ast.Node) bool

Contains reports whether s contains x.

func (*AstSet) Insert

func (s *AstSet) Insert(x ast.Node) bool

Insert pushes x in s if it's not already there. Returns true if element was inserted.

func (*AstSet) Len

func (s *AstSet) Len() int

Len returns the number of elements contained inside s.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL