Documentation
¶
Index ¶
- Constants
- func FromRecord(run rt.Runtime, rec *g.Record) rt.Scope
- func NewReadOnlyValue(name string, val g.Value) rt.Scope
- type Chain
- func (s *Chain) FieldByName(field string) (ret g.Value, err error)
- func (s *Chain) PopScope()
- func (s *Chain) PushScope(top rt.Scope)
- func (s *Chain) ReplaceScope(top rt.Scope) Chain
- func (s *Chain) RestoreScope(c Chain)
- func (s *Chain) SetFieldByName(field string, v g.Value) (err error)
- func (s *Chain) SetFieldDirty(field string) (err error)
- type Empty
- type Pairs
- type SingleValue
Constants ¶
const MaxDepth = 25
Variables ¶
This section is empty.
Functions ¶
func FromRecord ¶
creates a scope from a record requires the runtime in order to create default values for empty fields
func NewReadOnlyValue ¶
creates a scope that provides a single named value; errors if the author tries to *replace* the value, noting that altering the *contents* of a value does not cause an error. ( ex. altering the fields of a record value or the elements of an array. )
Types ¶
type Chain ¶
a linked list of scopes: if a variable isnt found in the first scope, the next is searched, and so on.
func (*Chain) FieldByName ¶
FieldByName returns the value at 'field'
func (*Chain) ReplaceScope ¶
rewrite the current scope as the passed scope returns the previous scope ( used for function calls; they "hide" all variables from the caller stack )
func (*Chain) RestoreScope ¶
func (*Chain) SetFieldByName ¶
SetFieldByName writes the value of 'v' into the value at 'field'.
func (*Chain) SetFieldDirty ¶
SetFieldDirty - tell the current scope the named value has changed.
type Pairs ¶
type Pairs struct {
// contains filtered or unexported fields
}
a scope which provides a single named field.
func (*Pairs) SetFieldByName ¶
func (*Pairs) SetFieldDirty ¶
placeholder method: for now, determines whether the field exists
type SingleValue ¶
type SingleValue struct {
// contains filtered or unexported fields
}
a scope which provides a single named field.
func NewSingleValue ¶
func NewSingleValue(name string, val g.Value) *SingleValue
func (*SingleValue) FieldByName ¶
func (k *SingleValue) FieldByName(field string) (ret g.Value, err error)
func (*SingleValue) SetFieldByName ¶
func (k *SingleValue) SetFieldByName(field string, val g.Value) (err error)
func (*SingleValue) SetFieldDirty ¶
func (k *SingleValue) SetFieldDirty(field string) (err error)
placeholder method: for now, determines whether the field exists
func (*SingleValue) SetValue ¶
func (k *SingleValue) SetValue(val g.Value)
backdoor for updating the value of held by this scope. panics if the value was created read-only