internal

package
v0.0.0-...-ac77c9d Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpNode

func DumpNode(node ast.Node) []byte

DumpNode returns the source code representation of the given node.

func ExpressionType

func ExpressionType(pass *analysis.Pass, s ast.Expr) (types.BasicKind, bool)

ExpressionType returns the type of the expression s, if it is of a basic type.

func ImportInfo

func ImportInfo(pass *analysis.Pass, node ast.Node) (alias, path string, ok bool)

ImportInfo returns the alias and path of the import referenced by node.

If node is an import spec, the alias is the name of the imported package and the path is the import path. If node is a selector expression, the alias is the package name and the path is the import path. If node is a call expression, the alias is the package name and the path is the import path.

Alais is always populated, either with the package name or the package alias.

If node is not an import spec, selector expression, or call expression, ok is false.

func IsEffectiveIncByOne

func IsEffectiveIncByOne(ident ast.Expr, inc ast.Stmt) bool

IsEffectiveIncByOne returns true if the increment statement is an effective increment by one. This will return true for if inc increments ident with an expression of the form 'i++', 'i += 1' and 'i = i + 1'.

func IsGenerated

func IsGenerated(file *ast.File) bool

IsGenerated returns true if the file is generated.

func IsLiteralZero

func IsLiteralZero(expr ast.Expr) bool

IsLiteralZero returns true if expr is a literal zero.

func IsString

func IsString(pass *analysis.Pass, s ast.Expr) bool

IsString returns true if the type of s is "string"

func LenOf

func LenOf(pass *analysis.Pass, expr ast.Expr) (ast.Expr, bool)

LenOf returns true and the argument of the len call if expr is a call to len,

func NameToBasicKind

func NameToBasicKind(name string) types.BasicKind

NameToBasicKind returns the basic kind of the type with the given name.

func NamesMatch

func NamesMatch(x, y ast.Expr) bool

NamesMatch returns true if x and y are of the same type and have the same name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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