Documentation
¶
Index ¶
- type CannotCastToString
- type CannotStoreScopedAccountInMeta
- type CompilerError
- type DuplicateRemaining
- type ExperimentalFeature
- type FeatureNotImplemented
- type InvalidFeature
- type InvalidMetaPosition
- type InvalidScopedAccountPosition
- type InvalidUncappedSource
- type InvalidVariableValue
- type MissingVariable
- type TypeError
- type UnboundVar
- type UnsupportedNode
- type VarsEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CannotCastToString ¶
CannotCastToString is reported for an interpolation part whose type has no string form (monetary, asset, portion).
func (CannotCastToString) Error ¶
func (e CannotCastToString) Error() string
type CannotStoreScopedAccountInMeta ¶
CannotStoreScopedAccountInMeta is reported when a scoped account (the result of scoped()) is used as the *value* stored by set_tx_meta or set_account_meta. Mirrors the interpreter's runtime error of the same name, but caught at compile time since the compiler already knows an expression's scopedness statically.
func (CannotStoreScopedAccountInMeta) Error ¶
func (CannotStoreScopedAccountInMeta) Error() string
type CompilerError ¶
type DuplicateRemaining ¶
func (DuplicateRemaining) Error ¶
func (DuplicateRemaining) Error() string
type ExperimentalFeature ¶
type ExperimentalFeature struct {
parser.Range
FlagName flags.FeatureFlag
}
ExperimentalFeature is reported when the script uses a construct gated behind a feature flag that wasn't enabled. Mirrors the interpreter's interpreter.ExperimentalFeature.
func (ExperimentalFeature) Error ¶
func (e ExperimentalFeature) Error() string
type FeatureNotImplemented ¶
FeatureNotImplemented is returned (never panicked) when the compiler meets a construct it does not support yet — e.g. colors or scoped accounts — so the host gets an error instead of a crash.
func (FeatureNotImplemented) Error ¶
func (e FeatureNotImplemented) Error() string
type InvalidFeature ¶
InvalidFeature is reported when a #![feature(..)] declaration names a flag that doesn't exist.
func (InvalidFeature) Error ¶
func (e InvalidFeature) Error() string
type InvalidMetaPosition ¶
InvalidMetaPosition is reported when meta() appears anywhere other than as a top-level variable origin (the only place it's supported).
func (InvalidMetaPosition) Error ¶
func (InvalidMetaPosition) Error() string
type InvalidScopedAccountPosition ¶
InvalidScopedAccountPosition is reported when scoped() is reached from a position that only wants a plain string/generic value (e.g. account interpolation, or any other non-account context) — a defensive check that should be unreachable given the compiler's other call sites already route account-typed expressions through compileAccountExpr.
func (InvalidScopedAccountPosition) Error ¶
func (InvalidScopedAccountPosition) Error() string
type InvalidUncappedSource ¶
func (InvalidUncappedSource) Error ¶
func (InvalidUncappedSource) Error() string
type InvalidVariableValue ¶ added in v0.1.2
InvalidVariableValue is returned by Encode when a variable's raw value does not parse as its declared type.
func (InvalidVariableValue) Error ¶ added in v0.1.2
func (e InvalidVariableValue) Error() string
func (InvalidVariableValue) Unwrap ¶ added in v0.1.2
func (e InvalidVariableValue) Unwrap() error
type MissingVariable ¶ added in v0.1.2
type MissingVariable struct {
Name string
}
MissingVariable is returned by Encode when the payload has no value for a declared variable.
func (MissingVariable) Error ¶ added in v0.1.2
func (e MissingVariable) Error() string
type UnboundVar ¶
func (UnboundVar) Error ¶
func (e UnboundVar) Error() string
type UnsupportedNode ¶
UnsupportedNode is the compiler's defensive backstop for a switch over an AST node, operator, or builtin name that's meant to be exhaustive (every case the parser/typecheck can currently produce is handled) but isn't enforced as such by the Go compiler — e.g. a switch on a string-typed operator, or a fixed set of builtin names. Reaching it means the compiler has drifted out of sync with the parser or typecheck, not something a script can trigger, so the message carries a debug dump rather than user-actionable text.
func (UnsupportedNode) Error ¶
func (e UnsupportedNode) Error() string
type VarsEncoder ¶
type VarsEncoder struct {
// contains filtered or unexported fields
}
func Compile ¶
func Compile(program parser.Program, featureFlags map[string]struct{}) (VarsEncoder, vm.Program, error)
Compile lowers a parsed program to the VarsEncoder that turns a json var payload into the vm.Vars the program expects, plus the vm.Program itself.
featureFlags is the set of experimental features the host allows; a construct gated behind a flag that isn't in the set fails compilation. As in interpreter.RunProgram, the script's own #![feature(..)] declarations are unioned in.