Documentation ¶
Overview ¶
Package bzlenv provides function to create and update a static environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectLValues ¶
CollectLValues returns the list of identifiers that are assigned (assuming that node is a valid LValue). For example, it returns `a`, `b` and `c` for the input `a, (b, c)`.
func WalkOnceWithEnvironment ¶
func WalkOnceWithEnvironment(node build.Expr, env *Environment, fct func(e *build.Expr, env *Environment))
WalkOnceWithEnvironment calls fct on every child of node, while maintaining the Environment of all available symbols.
Types ¶
type Environment ¶
type Environment struct { Blocks []block Function *build.DefStmt // enclosing function (or nil on top-level) Stack []build.Expr // parents of the current node // contains filtered or unexported fields }
Environment represents a static environment (e.g. information about all available symbols).
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment creates a new empty Environment.
func (*Environment) Get ¶
func (e *Environment) Get(name string) *NameInfo
Get resolves the name and resolves information about the binding (or nil if it's not defined).
type NameInfo ¶
type NameInfo struct { ID int // unique identifier Name string // name of the variable (not unique) Kind ValueKind Definition build.Expr // node that defines the value }
NameInfo represents information about a symbol name.
type ValueKind ¶
type ValueKind int
ValueKind describes how a binding was declared.