nameinfer

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FunctionsWithGetter = []string{
	"For",
	"ForPointer",
	"Transform",
	"ForSlice",
	"ForMap",
}

Functions

func Frame

func Frame(skipFrames int) (file string, line int)

Frame returns the file and line number of the caller. It's intended to be used in the context of [govy.For] and similar functions.

func GetGovyImportName

func GetGovyImportName(f *ast.File) string

func InferName

func InferName(file string, line int) string

func InferNameFromFile

func InferNameFromFile(fileSet *token.FileSet, pkg *packages.Package, f *ast.File, line int) string

Types

type ModuleAST

type ModuleAST struct {
	FileSet  *token.FileSet
	Packages map[string]*packages.Package
}

func NewModuleAST

func NewModuleAST(root string) ModuleAST

func (ModuleAST) FindFile

func (a ModuleAST) FindFile(file string) (*packages.Package, *ast.File)

Jump to

Keyboard shortcuts

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