Documentation ¶
Overview ¶
Package scope provides the Scope type, which is used by an evaluator.Evaluator to look up and store scope-specific values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scope ¶
type Scope struct { // Parent is the parent scope of this scope. Parent *Scope // contains filtered or unexported fields }
Scope is a map of values indexed by identifiers.
A scope may have a parent scope. If the current scope does not store a value for a specific identifier, the parent scopes will be considered (recursively.)
func (*Scope) ClearSelf ¶
func (s *Scope) ClearSelf()
ClearSelf removes all values associated with this scope, not including any parent scopes.
func (*Scope) HasValue ¶
HasValue returns whether the scope or any of its parent scopes store a value identified by name.
func (*Scope) Lock ¶
func (s *Scope) Lock()
Lock prevents this scope from further modification. Parent scopes (if any) will not be locked.
func (*Scope) Set ¶
Set stores the value v identified by name in the scope.
If the scope has a parent scope, and that parent scope already stores a value for that identifier, the value is stored (overwritten) in the parent scope instead. Parent scopes are considered recursively until there is no parent scope.
If the scope where the value should be stored is locked, nothing will happen.