globals

package
v0.0.0-...-23e6066 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package globals provides an AST visitor that calls the visit function for all global identifiers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIdent

func GetIdent(expr ast.Expr) *ast.Ident

GetIdent returns the identifier associated with the given expression by removing parentheses if needed.

func Visit

func Visit(fset *token.FileSet, file *ast.File, f func(*ast.Ident, SymKind))

Visit traverses the provided AST and calls f() for each identifier that refers to global names. The global name must be defined in the file itself.

The function f() is allowed to modify the identifier, for example, to rename uses of global references.

Types

type SymKind

type SymKind int

SymKind specifies the kind of a global symbol. For example, a variable, const function, etc.

const (
	KindUnknown SymKind = iota
	KindImport
	KindType
	KindVar
	KindConst
	KindFunction
	KindReceiver
	KindParameter
	KindResult
	KindTag
)

Constants for different kinds of symbols.

Jump to

Keyboard shortcuts

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