Documentation
¶
Index ¶
- Variables
- func DefaultBuiltinGlobals() *activations.Activation[Variable]
- func NewArgumentTypesIterator(context *Context, arguments []bbq.StaticType) interpreter.ArgumentTypesIterator
- func NewTypeArgumentsIterator(context *Context, arguments []bbq.StaticType) interpreter.TypeArgumentsIterator
- func UnwrapOptionalType(ty bbq.StaticType) bbq.StaticType
- type BoundFunctionValue
- func (v *BoundFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
- func (v *BoundFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
- func (v *BoundFunctionValue) ComputeFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (v *BoundFunctionValue) ConformsToStaticType(_ interpreter.ValueStaticTypeConformanceContext, ...) bool
- func (v *BoundFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
- func (v *BoundFunctionValue) DereferenceReceiver() bool
- func (v *BoundFunctionValue) FunctionType(context interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (v *BoundFunctionValue) HasComputedFunctionType() bool
- func (v *BoundFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
- func (v *BoundFunctionValue) IsFunctionValue()
- func (v *BoundFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
- func (v *BoundFunctionValue) IsNative() bool
- func (v *BoundFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
- func (*BoundFunctionValue) IsValue()
- func (v *BoundFunctionValue) MaybeDereferencedReceiver(context interpreter.ValueStaticTypeContext) Value
- func (v *BoundFunctionValue) MeteredString(context interpreter.ValueStringContext, _ interpreter.SeenReferences) string
- func (v *BoundFunctionValue) NeedsStoreTo(_ atree.Address) bool
- func (v *BoundFunctionValue) Receiver(context interpreter.ReferenceCreationContext) ImplicitReferenceValue
- func (v *BoundFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
- func (v *BoundFunctionValue) StaticType(context interpreter.ValueStaticTypeContext) bbq.StaticType
- func (v *BoundFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
- func (v *BoundFunctionValue) String() string
- func (v *BoundFunctionValue) Transfer(_ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, ...) interpreter.Value
- func (v *BoundFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
- type BuiltinGlobalsProvider
- type CompiledFunctionValue
- func (*CompiledFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
- func (v *CompiledFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
- func (v *CompiledFunctionValue) ComputeFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (*CompiledFunctionValue) ConformsToStaticType(_ interpreter.ValueStaticTypeConformanceContext, ...) bool
- func (*CompiledFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
- func (v *CompiledFunctionValue) DereferenceReceiver() bool
- func (v *CompiledFunctionValue) FunctionType(interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (*CompiledFunctionValue) HasComputedFunctionType() bool
- func (v *CompiledFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
- func (*CompiledFunctionValue) IsFunctionValue()
- func (*CompiledFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
- func (v *CompiledFunctionValue) IsNative() bool
- func (*CompiledFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
- func (*CompiledFunctionValue) IsValue()
- func (v *CompiledFunctionValue) MeteredString(context interpreter.ValueStringContext, _ interpreter.SeenReferences) string
- func (*CompiledFunctionValue) NeedsStoreTo(_ atree.Address) bool
- func (v *CompiledFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
- func (v *CompiledFunctionValue) StaticType(interpreter.ValueStaticTypeContext) bbq.StaticType
- func (v *CompiledFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
- func (v *CompiledFunctionValue) String() string
- func (v *CompiledFunctionValue) Transfer(context interpreter.ValueTransferContext, _ atree.Address, remove bool, ...) interpreter.Value
- func (*CompiledFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
- type Config
- func (c *Config) EmitEvent(context interpreter.ValueExportContext, eventType *sema.CompositeType, ...)
- func (c *Config) GetAccountHandlerFunc() interpreter.AccountHandlerFunc
- func (c *Config) GetCapabilityBorrowHandler() interpreter.CapabilityBorrowHandlerFunc
- func (c *Config) GetCapabilityCheckHandler() interpreter.CapabilityCheckHandlerFunc
- func (c *Config) GetCompositeType(location common.Location, qualifiedIdentifier string, ...) (*sema.CompositeType, error)
- func (c *Config) GetEntitlementMapType(typeID interpreter.TypeID, ...) (*sema.EntitlementMapType, error)
- func (c *Config) GetEntitlementType(typeID interpreter.TypeID, ...) (*sema.EntitlementType, error)
- func (c *Config) GetInjectedCompositeFieldsHandler() interpreter.InjectedCompositeFieldsHandlerFunc
- func (c *Config) GetInterfaceType(location common.Location, qualifiedIdentifier string, ...) (*sema.InterfaceType, error)
- func (c *Config) GetValidateAccountCapabilitiesGetHandler() interpreter.ValidateAccountCapabilitiesGetHandlerFunc
- func (c *Config) GetValidateAccountCapabilitiesPublishHandler() interpreter.ValidateAccountCapabilitiesPublishHandlerFunc
- func (c *Config) MeterComputation(usage common.ComputationUsage) error
- func (c *Config) MeterMemory(usage common.MemoryUsage) error
- func (c *Config) OnResourceOwnerChange(resource *interpreter.CompositeValue, oldOwner common.Address, ...)
- func (c *Config) SetStorage(storage interpreter.Storage)
- func (c *Config) Storage() interpreter.Storage
- func (c *Config) WithDebugEnabled() *Config
- type Context
- func (c *Context) CanonicalAtreeContainer(valueID atree.ValueID) interpreter.Value
- func (c *Context) ClearAllCanonicalAtreeContainers()
- func (c *Context) ClearCanonicalAtreeContainer(valueID atree.ValueID)
- func (c *Context) ClearReferencedResourceKindedValues(valueID atree.ValueID)
- func (c *Context) DefaultDestroyEvents(resourceValue *interpreter.CompositeValue) []*interpreter.CompositeValue
- func (c *Context) EnforceNotResourceDestruction(valueID atree.ValueID)
- func (c *Context) GetCapabilityControllerIterations() map[interpreter.AddressPath]int
- func (c *Context) GetCompositeType(location common.Location, qualifiedIdentifier string, typeID common.TypeID) (*sema.CompositeType, error)
- func (c *Context) GetCompositeValueFunctions(v *interpreter.CompositeValue) *interpreter.FunctionOrderedMap
- func (c *Context) GetContractValue(contractLocation common.AddressLocation) *interpreter.CompositeValue
- func (c *Context) GetEntitlementMapType(typeID common.TypeID) (*sema.EntitlementMapType, error)
- func (c *Context) GetEntitlementType(typeID common.TypeID) (*sema.EntitlementType, error)
- func (c *Context) GetEnumCaseCount(enumType *sema.CompositeType) (int, error)
- func (c *Context) GetFunction(location common.Location, name string) FunctionValue
- func (c *Context) GetInterfaceType(location common.Location, qualifiedIdentifier string, typeID common.TypeID) (*sema.InterfaceType, error)
- func (c *Context) GetLocation() common.Location
- func (c *Context) GetMemberAccessContextForLocation(location common.Location) interpreter.MemberAccessibleContext
- func (c *Context) GetMethod(value interpreter.MemberAccessibleValue, name string, ...) interpreter.FunctionValue
- func (c *Context) GetResourceDestructionContextForLocation(location common.Location) interpreter.ResourceDestructionContext
- func (c *Context) GetValueOfVariable(name string) interpreter.Value
- func (c *Context) InStorageIteration() bool
- func (c *Context) InvokeFunction(fn interpreter.FunctionValue, arguments []interpreter.Value, ...) interpreter.Value
- func (c *Context) IsSubType(subType interpreter.StaticType, superType interpreter.StaticType) bool
- func (c *Context) IsTypeInfoRecovered(location common.Location) bool
- func (c *Context) LocationRange() interpreter.LocationRange
- func (c *Context) MaybeTrackReferencedResourceKindedValue(referenceValue *interpreter.EphemeralReferenceValue)
- func (c *Context) MaybeValidateAtreeStorage()
- func (c *Context) MaybeValidateAtreeValue(v atree.Value)
- func (c *Context) MutationDuringCapabilityControllerIteration() bool
- func (c *Context) NewFunctionWithType(funcValue interpreter.FunctionValue, ...) interpreter.FunctionValue
- func (c *Context) ReadStored(storageAddress common.Address, domain common.StorageDomain, ...) interpreter.Value
- func (c *Context) RecordStorageMutation()
- func (c *Context) RecoverErrors(onError func(error))
- func (c *Context) ReferencedResourceKindedValues(valueID atree.ValueID) ReferenceSet
- func (c *Context) RemoveStored(storageAddress common.Address, domain common.StorageDomain, ...) atree.Storable
- func (c *Context) SemaAccessFromStaticAuthorization(auth interpreter.Authorization) (sema.Access, error)
- func (c *Context) SemaTypeFromStaticType(staticType interpreter.StaticType) sema.Type
- func (c *Context) SetAttachmentIteration(composite *interpreter.CompositeValue, state bool) bool
- func (c *Context) SetCanonicalAtreeContainer(valueID atree.ValueID, v interpreter.Value)
- func (c *Context) SetInStorageIteration(inStorageIteration bool)
- func (c *Context) SetMutationDuringCapabilityControllerIteration()
- func (c *Context) StorageMutatedDuringIteration() bool
- func (c *Context) ValidateContainerMutation(valueID atree.ValueID)
- func (c *Context) WithContainerMutationPrevention(valueID atree.ValueID, f func())
- func (c *Context) WithResourceDestruction(valueID atree.ValueID, f func())
- func (c *Context) WriteStored(storageAddress common.Address, domain common.StorageDomain, ...) (existed bool)
- type ContractValueHandler
- type ElaborationResolver
- type EntitlementMapTypeHandlerFunc
- type EntitlementTypeHandlerFunc
- type ExecutableProgram
- type FunctionValue
- type ImplicitReferenceValue
- func (v ImplicitReferenceValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
- func (v ImplicitReferenceValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
- func (v ImplicitReferenceValue) ConformsToStaticType(_ interpreter.ValueStaticTypeConformanceContext, ...) bool
- func (v ImplicitReferenceValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
- func (v ImplicitReferenceValue) GetAuthorization() interpreter.Authorization
- func (v ImplicitReferenceValue) IsImportable(_ interpreter.ValueImportableContext) bool
- func (v ImplicitReferenceValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
- func (v ImplicitReferenceValue) IsValue()
- func (v ImplicitReferenceValue) MeteredString(_ interpreter.ValueStringContext, _ interpreter.SeenReferences) string
- func (v ImplicitReferenceValue) NeedsStoreTo(_ atree.Address) bool
- func (v ImplicitReferenceValue) RecursiveString(_ interpreter.SeenReferences) string
- func (v ImplicitReferenceValue) ReferencedValue(context interpreter.ValueStaticTypeContext) interpreter.Value
- func (v ImplicitReferenceValue) StaticType(_ interpreter.ValueStaticTypeContext) interpreter.StaticType
- func (v ImplicitReferenceValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
- func (v ImplicitReferenceValue) String() string
- func (v ImplicitReferenceValue) Transfer(_ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, ...) interpreter.Value
- func (v ImplicitReferenceValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
- type IteratorWrapperValue
- func (v IteratorWrapperValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
- func (v IteratorWrapperValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
- func (v IteratorWrapperValue) ConformsToStaticType(_ interpreter.ValueStaticTypeConformanceContext, ...) bool
- func (v IteratorWrapperValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
- func (v IteratorWrapperValue) IsImportable(_ interpreter.ValueImportableContext) bool
- func (v IteratorWrapperValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
- func (v IteratorWrapperValue) IsValue()
- func (v IteratorWrapperValue) MeteredString(_ interpreter.ValueStringContext, _ interpreter.SeenReferences) string
- func (v IteratorWrapperValue) NeedsStoreTo(_ atree.Address) bool
- func (v IteratorWrapperValue) RecursiveString(_ interpreter.SeenReferences) string
- func (v IteratorWrapperValue) StaticType(_ interpreter.ValueStaticTypeContext) interpreter.StaticType
- func (v IteratorWrapperValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
- func (v IteratorWrapperValue) String() string
- func (v IteratorWrapperValue) Transfer(_ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, ...) interpreter.Value
- func (v IteratorWrapperValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
- type LinkedGlobals
- type LinkerError
- type NativeFunctionValue
- func (v *NativeFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
- func (v *NativeFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
- func (v *NativeFunctionValue) ComputeFunctionType(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (v *NativeFunctionValue) ConformsToStaticType(_ interpreter.ValueStaticTypeConformanceContext, ...) bool
- func (v *NativeFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
- func (v *NativeFunctionValue) DereferenceReceiver() bool
- func (v *NativeFunctionValue) FunctionType(interpreter.ValueStaticTypeContext) *sema.FunctionType
- func (v *NativeFunctionValue) GetMember(context interpreter.MemberAccessibleContext, name string, ...) interpreter.Value
- func (v *NativeFunctionValue) GetMethod(_ interpreter.MemberAccessibleContext, _ string, _ interpreter.ReferenceValue) interpreter.FunctionValue
- func (v *NativeFunctionValue) HasComputedFunctionType() bool
- func (v *NativeFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
- func (v *NativeFunctionValue) IsFunctionValue()
- func (v *NativeFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
- func (v *NativeFunctionValue) IsNative() bool
- func (v *NativeFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
- func (*NativeFunctionValue) IsValue()
- func (v *NativeFunctionValue) MeteredString(context interpreter.ValueStringContext, _ interpreter.SeenReferences) string
- func (v *NativeFunctionValue) NeedsStoreTo(_ atree.Address) bool
- func (v *NativeFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
- func (*NativeFunctionValue) RemoveMember(_ interpreter.ValueTransferContext, _ string) interpreter.Value
- func (*NativeFunctionValue) SetMember(_ interpreter.ValueTransferContext, _ string, _ interpreter.Value) bool
- func (v *NativeFunctionValue) StaticType(context interpreter.ValueStaticTypeContext) bbq.StaticType
- func (v *NativeFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
- func (v *NativeFunctionValue) String() string
- func (v *NativeFunctionValue) Transfer(_ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, ...) interpreter.Value
- func (v *NativeFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
- func (v *NativeFunctionValue) WithDereferenceReceiver(dereferenceReceiver bool) *NativeFunctionValue
- type ReferenceSet
- type ReferencedResourceKindedValues
- type UnknownFunctionError
- type Upvalue
- type VM
- func (vm *VM) Context() *Context
- func (vm *VM) Global(name string) Value
- func (vm *VM) InitializeContract(contractName string, arguments ...Value) (*interpreter.CompositeValue, error)
- func (vm *VM) InvokeExternally(name string, arguments ...Value) (v Value, err error)
- func (vm *VM) InvokeExternallyUncheckedForTestingOnly(name string, arguments ...Value) (v Value, err error)deprecated
- func (vm *VM) InvokeMethodExternally(name string, receiver interpreter.MemberAccessibleValue, arguments ...Value) (v Value, err error)
- func (vm *VM) InvokeTransaction(arguments []Value, signers ...Value) (err error)
- func (vm *VM) InvokeTransactionExecute(transaction *interpreter.SimpleCompositeValue) error
- func (vm *VM) InvokeTransactionInit(transactionArgs []Value) error
- func (vm *VM) InvokeTransactionPrepare(transaction *interpreter.SimpleCompositeValue, signers []Value) error
- func (vm *VM) InvokeTransactionWrapper() (*interpreter.SimpleCompositeValue, error)
- func (vm *VM) LocationRange() interpreter.LocationRange
- func (vm *VM) RecoverErrors(onError func(error))
- func (vm *VM) Reset()
- func (vm *VM) StackSize() int
- type VMArgumentTypesIterator
- type VMTypeArgumentsIterator
- type Value
- type Variable
Constants ¶
This section is empty.
Variables ¶
var CommonBuiltinTypeBoundFunctions = []*NativeFunctionValue{ NewNativeFunctionValue( sema.IsInstanceFunctionName, sema.IsInstanceFunctionType, interpreter.NativeIsInstanceFunction, ).WithDereferenceReceiver(false), NewNativeFunctionValue( sema.GetTypeFunctionName, sema.GetTypeFunctionType, interpreter.NativeGetTypeFunction, ).WithDereferenceReceiver(false), }
Built-in functions that are common to all the types.
var IndexedCommonBuiltinTypeBoundFunctions = map[string]*NativeFunctionValue{}
Functions ¶
func DefaultBuiltinGlobals ¶
func DefaultBuiltinGlobals() *activations.Activation[Variable]
func NewArgumentTypesIterator ¶ added in v1.9.5
func NewArgumentTypesIterator(context *Context, arguments []bbq.StaticType) interpreter.ArgumentTypesIterator
func NewTypeArgumentsIterator ¶ added in v1.8.0
func NewTypeArgumentsIterator(context *Context, arguments []bbq.StaticType) interpreter.TypeArgumentsIterator
func UnwrapOptionalType ¶
func UnwrapOptionalType(ty bbq.StaticType) bbq.StaticType
UnwrapOptionalType returns the type if it is not an optional type, or the inner-most type if it is (optional types are repeatedly unwrapped)
Types ¶
type BoundFunctionValue ¶
type BoundFunctionValue struct {
ReceiverReference interpreter.ReferenceValue
ReceiverIsReference bool
Method FunctionValue
Base *interpreter.EphemeralReferenceValue
// contains filtered or unexported fields
}
BoundFunctionValue is a function-wrapper which captures the receivers of an object-method.
func NewBoundFunctionValue ¶
func NewBoundFunctionValue( context interpreter.ReferenceCreationContext, receiver interpreter.Value, accessedReference interpreter.ReferenceValue, method FunctionValue, base *interpreter.EphemeralReferenceValue, ) *BoundFunctionValue
func (*BoundFunctionValue) Accept ¶
func (v *BoundFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
func (*BoundFunctionValue) Clone ¶
func (v *BoundFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
func (*BoundFunctionValue) ComputeFunctionType ¶ added in v1.10.3
func (v *BoundFunctionValue) ComputeFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*BoundFunctionValue) ConformsToStaticType ¶
func (v *BoundFunctionValue) ConformsToStaticType( _ interpreter.ValueStaticTypeConformanceContext, _ interpreter.TypeConformanceResults, ) bool
func (*BoundFunctionValue) DeepRemove ¶
func (v *BoundFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
func (*BoundFunctionValue) DereferenceReceiver ¶ added in v1.10.3
func (v *BoundFunctionValue) DereferenceReceiver() bool
func (*BoundFunctionValue) FunctionType ¶
func (v *BoundFunctionValue) FunctionType(context interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*BoundFunctionValue) HasComputedFunctionType ¶ added in v1.10.3
func (v *BoundFunctionValue) HasComputedFunctionType() bool
func (*BoundFunctionValue) Invoke ¶
func (v *BoundFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
func (*BoundFunctionValue) IsFunctionValue ¶
func (v *BoundFunctionValue) IsFunctionValue()
func (*BoundFunctionValue) IsImportable ¶
func (v *BoundFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
func (*BoundFunctionValue) IsNative ¶
func (v *BoundFunctionValue) IsNative() bool
func (*BoundFunctionValue) IsResourceKinded ¶
func (v *BoundFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
func (*BoundFunctionValue) IsValue ¶
func (*BoundFunctionValue) IsValue()
func (*BoundFunctionValue) MaybeDereferencedReceiver ¶ added in v1.10.3
func (v *BoundFunctionValue) MaybeDereferencedReceiver(context interpreter.ValueStaticTypeContext) Value
func (*BoundFunctionValue) MeteredString ¶
func (v *BoundFunctionValue) MeteredString( context interpreter.ValueStringContext, _ interpreter.SeenReferences, ) string
func (*BoundFunctionValue) NeedsStoreTo ¶
func (v *BoundFunctionValue) NeedsStoreTo(_ atree.Address) bool
func (*BoundFunctionValue) Receiver ¶
func (v *BoundFunctionValue) Receiver(context interpreter.ReferenceCreationContext) ImplicitReferenceValue
func (*BoundFunctionValue) RecursiveString ¶
func (v *BoundFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
func (*BoundFunctionValue) StaticType ¶
func (v *BoundFunctionValue) StaticType(context interpreter.ValueStaticTypeContext) bbq.StaticType
func (*BoundFunctionValue) Storable ¶
func (v *BoundFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
func (*BoundFunctionValue) String ¶
func (v *BoundFunctionValue) String() string
func (*BoundFunctionValue) Transfer ¶
func (v *BoundFunctionValue) Transfer( _ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, _ map[atree.ValueID]struct{}, _ bool, ) interpreter.Value
func (*BoundFunctionValue) Walk ¶
func (v *BoundFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
type BuiltinGlobalsProvider ¶
type BuiltinGlobalsProvider func(location common.Location) *activations.Activation[Variable]
type CompiledFunctionValue ¶
type CompiledFunctionValue struct {
Function *bbq.Function[opcode.Instruction]
Executable *ExecutableProgram
Type interpreter.FunctionStaticType
Upvalues []*Upvalue
}
func (*CompiledFunctionValue) Accept ¶
func (*CompiledFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
func (*CompiledFunctionValue) Clone ¶
func (v *CompiledFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
func (*CompiledFunctionValue) ComputeFunctionType ¶ added in v1.10.3
func (v *CompiledFunctionValue) ComputeFunctionType(_ Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*CompiledFunctionValue) ConformsToStaticType ¶
func (*CompiledFunctionValue) ConformsToStaticType( _ interpreter.ValueStaticTypeConformanceContext, _ interpreter.TypeConformanceResults, ) bool
func (*CompiledFunctionValue) DeepRemove ¶
func (*CompiledFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
func (*CompiledFunctionValue) DereferenceReceiver ¶ added in v1.10.3
func (v *CompiledFunctionValue) DereferenceReceiver() bool
func (*CompiledFunctionValue) FunctionType ¶
func (v *CompiledFunctionValue) FunctionType(interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*CompiledFunctionValue) HasComputedFunctionType ¶ added in v1.10.3
func (*CompiledFunctionValue) HasComputedFunctionType() bool
func (*CompiledFunctionValue) Invoke ¶
func (v *CompiledFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
func (*CompiledFunctionValue) IsFunctionValue ¶
func (*CompiledFunctionValue) IsFunctionValue()
func (*CompiledFunctionValue) IsImportable ¶
func (*CompiledFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
func (*CompiledFunctionValue) IsNative ¶
func (v *CompiledFunctionValue) IsNative() bool
func (*CompiledFunctionValue) IsResourceKinded ¶
func (*CompiledFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
func (*CompiledFunctionValue) IsValue ¶
func (*CompiledFunctionValue) IsValue()
func (*CompiledFunctionValue) MeteredString ¶
func (v *CompiledFunctionValue) MeteredString( context interpreter.ValueStringContext, _ interpreter.SeenReferences, ) string
func (*CompiledFunctionValue) NeedsStoreTo ¶
func (*CompiledFunctionValue) NeedsStoreTo(_ atree.Address) bool
func (*CompiledFunctionValue) RecursiveString ¶
func (v *CompiledFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
func (*CompiledFunctionValue) StaticType ¶
func (v *CompiledFunctionValue) StaticType(interpreter.ValueStaticTypeContext) bbq.StaticType
func (*CompiledFunctionValue) Storable ¶
func (v *CompiledFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
func (*CompiledFunctionValue) String ¶
func (v *CompiledFunctionValue) String() string
func (*CompiledFunctionValue) Transfer ¶
func (v *CompiledFunctionValue) Transfer( context interpreter.ValueTransferContext, _ atree.Address, remove bool, storable atree.Storable, _ map[atree.ValueID]struct{}, _ bool, ) interpreter.Value
func (*CompiledFunctionValue) Walk ¶
func (*CompiledFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
type Config ¶
type Config struct {
interpreter.Tracer
ImportHandler commons.ImportHandler
ElaborationResolver ElaborationResolver
ContractValueHandler ContractValueHandler
// BuiltinGlobalsProvider provides the built-in globals for a given location.
// NOTE: all global must be defined for location nil!
BuiltinGlobalsProvider BuiltinGlobalsProvider
// CompositeTypeHandler is used to load composite types
CompositeTypeHandler interpreter.CompositeTypeHandlerFunc
// InterfaceTypeHandler is used to load interface types
InterfaceTypeHandler interpreter.InterfaceTypeHandlerFunc
// EntitlementTypeHandler is used to load entitlement types
EntitlementTypeHandler EntitlementTypeHandlerFunc
// EntitlementMapTypeHandler is used to load entitlement map types
EntitlementMapTypeHandler EntitlementMapTypeHandlerFunc
MemoryGauge common.MemoryGauge
ComputationGauge common.ComputationGauge
// CapabilityCheckHandler is used to check ID capabilities
CapabilityCheckHandler interpreter.CapabilityCheckHandlerFunc
// CapabilityBorrowHandler is used to borrow ID capabilities
CapabilityBorrowHandler interpreter.CapabilityBorrowHandlerFunc
// ValidateAccountCapabilitiesGetHandler is used to handle when a capability of an account is got.
ValidateAccountCapabilitiesGetHandler interpreter.ValidateAccountCapabilitiesGetHandlerFunc
// ValidateAccountCapabilitiesPublishHandler is used to handle when a capability of an account is got.
ValidateAccountCapabilitiesPublishHandler interpreter.ValidateAccountCapabilitiesPublishHandlerFunc
// OnEventEmitted is triggered when an event is emitted by the program
OnEventEmitted interpreter.OnEventEmittedFunc
// AccountHandlerFunc is used to handle accounts
AccountHandlerFunc interpreter.AccountHandlerFunc
// InjectedCompositeFieldsHandler is used to initialize new composite values' fields
InjectedCompositeFieldsHandler interpreter.InjectedCompositeFieldsHandlerFunc
// UUIDHandler is used to handle the generation of UUIDs
UUIDHandler interpreter.UUIDHandlerFunc
// AtreeStorageValidationEnabled determines if the validation of atree storage is enabled
AtreeStorageValidationEnabled bool
// AtreeValueValidationEnabled determines if the validation of atree values is enabled
AtreeValueValidationEnabled bool
// StackDepthLimit is the maximum depth of the call stack
StackDepthLimit uint64
// contains filtered or unexported fields
}
Config contains the VM configurations that is safe to be re-used across VMs/executions. It does not hold data specific to a single execution. i.e: No state is maintained.
func NewConfig ¶
func NewConfig(storage interpreter.Storage) *Config
func (*Config) EmitEvent ¶
func (c *Config) EmitEvent( context interpreter.ValueExportContext, eventType *sema.CompositeType, eventFields []interpreter.Value, )
func (*Config) GetAccountHandlerFunc ¶
func (c *Config) GetAccountHandlerFunc() interpreter.AccountHandlerFunc
func (*Config) GetCapabilityBorrowHandler ¶
func (c *Config) GetCapabilityBorrowHandler() interpreter.CapabilityBorrowHandlerFunc
func (*Config) GetCapabilityCheckHandler ¶
func (c *Config) GetCapabilityCheckHandler() interpreter.CapabilityCheckHandlerFunc
func (*Config) GetCompositeType ¶
func (c *Config) GetCompositeType( location common.Location, qualifiedIdentifier string, typeID interpreter.TypeID, ) (*sema.CompositeType, error)
func (*Config) GetEntitlementMapType ¶
func (c *Config) GetEntitlementMapType( typeID interpreter.TypeID, ensureProgramInitialized func(location common.Location), ) (*sema.EntitlementMapType, error)
func (*Config) GetEntitlementType ¶
func (c *Config) GetEntitlementType( typeID interpreter.TypeID, ensureProgramInitialized func(location common.Location), ) (*sema.EntitlementType, error)
func (*Config) GetInjectedCompositeFieldsHandler ¶
func (c *Config) GetInjectedCompositeFieldsHandler() interpreter.InjectedCompositeFieldsHandlerFunc
func (*Config) GetInterfaceType ¶
func (c *Config) GetInterfaceType( location common.Location, qualifiedIdentifier string, typeID interpreter.TypeID, ) (*sema.InterfaceType, error)
func (*Config) GetValidateAccountCapabilitiesGetHandler ¶
func (c *Config) GetValidateAccountCapabilitiesGetHandler() interpreter.ValidateAccountCapabilitiesGetHandlerFunc
func (*Config) GetValidateAccountCapabilitiesPublishHandler ¶
func (c *Config) GetValidateAccountCapabilitiesPublishHandler() interpreter.ValidateAccountCapabilitiesPublishHandlerFunc
func (*Config) MeterComputation ¶
func (c *Config) MeterComputation(usage common.ComputationUsage) error
func (*Config) MeterMemory ¶
func (c *Config) MeterMemory(usage common.MemoryUsage) error
func (*Config) OnResourceOwnerChange ¶
func (c *Config) OnResourceOwnerChange( resource *interpreter.CompositeValue, oldOwner common.Address, newOwner common.Address, )
func (*Config) SetStorage ¶
func (c *Config) SetStorage(storage interpreter.Storage)
func (*Config) Storage ¶
func (c *Config) Storage() interpreter.Storage
func (*Config) WithDebugEnabled ¶
type Context ¶
type Context struct {
*Config
CapabilityControllerIterations map[interpreter.AddressPath]int
// contains filtered or unexported fields
}
Context holds the information about the current execution at any given point of time. It consists of:
- Re-usable configurations (Config).
- State maintained for the current execution.
Should not be re-used across executions.
func NewContext ¶
func (*Context) CanonicalAtreeContainer ¶ added in v1.10.4
func (c *Context) CanonicalAtreeContainer(valueID atree.ValueID) interpreter.Value
func (*Context) ClearAllCanonicalAtreeContainers ¶ added in v1.10.4
func (c *Context) ClearAllCanonicalAtreeContainers()
ClearAllCanonicalAtreeContainers drops every entry in the canonical wrapper cache. Call this when the underlying `atree.Storage` is being swapped out (e.g. test harnesses that commit to a ledger and reopen storage): cached wrappers hold `*atree.Array`/`*atree.OrderedMap` pointers into the *old* storage, and would silently mutate the old storage if returned from a post-swap canonicalization.
func (*Context) ClearCanonicalAtreeContainer ¶ added in v1.10.4
func (*Context) ClearReferencedResourceKindedValues ¶
func (*Context) DefaultDestroyEvents ¶
func (c *Context) DefaultDestroyEvents(resourceValue *interpreter.CompositeValue) []*interpreter.CompositeValue
func (*Context) EnforceNotResourceDestruction ¶
func (*Context) GetCapabilityControllerIterations ¶
func (c *Context) GetCapabilityControllerIterations() map[interpreter.AddressPath]int
func (*Context) GetCompositeType ¶ added in v1.8.0
func (*Context) GetCompositeValueFunctions ¶
func (c *Context) GetCompositeValueFunctions(v *interpreter.CompositeValue) *interpreter.FunctionOrderedMap
func (*Context) GetContractValue ¶
func (c *Context) GetContractValue(contractLocation common.AddressLocation) *interpreter.CompositeValue
func (*Context) GetEntitlementMapType ¶ added in v1.8.0
func (*Context) GetEntitlementType ¶ added in v1.8.0
func (*Context) GetEnumCaseCount ¶ added in v1.10.6
func (c *Context) GetEnumCaseCount(enumType *sema.CompositeType) (int, error)
GetEnumCaseCount returns the number of declared cases of the given enum type. It returns an error if the case count cannot be determined, e.g. because the enum's elaboration is not available.
func (*Context) GetFunction ¶
func (c *Context) GetFunction( location common.Location, name string, ) FunctionValue
func (*Context) GetInterfaceType ¶ added in v1.8.0
func (*Context) GetLocation ¶
func (*Context) GetMemberAccessContextForLocation ¶
func (c *Context) GetMemberAccessContextForLocation(location common.Location) interpreter.MemberAccessibleContext
func (*Context) GetMethod ¶
func (c *Context) GetMethod( value interpreter.MemberAccessibleValue, name string, accessedReference interpreter.ReferenceValue, ) interpreter.FunctionValue
func (*Context) GetResourceDestructionContextForLocation ¶
func (c *Context) GetResourceDestructionContextForLocation(location common.Location) interpreter.ResourceDestructionContext
func (*Context) GetValueOfVariable ¶
func (c *Context) GetValueOfVariable(name string) interpreter.Value
func (*Context) InStorageIteration ¶
func (*Context) InvokeFunction ¶
func (c *Context) InvokeFunction( fn interpreter.FunctionValue, arguments []interpreter.Value, returnType sema.Type, ) interpreter.Value
InvokeFunction function invokes a given function value with the given arguments.
func (*Context) IsSubType ¶
func (c *Context) IsSubType(subType interpreter.StaticType, superType interpreter.StaticType) bool
func (*Context) IsTypeInfoRecovered ¶
func (*Context) LocationRange ¶ added in v1.8.0
func (c *Context) LocationRange() interpreter.LocationRange
func (*Context) MaybeTrackReferencedResourceKindedValue ¶
func (c *Context) MaybeTrackReferencedResourceKindedValue(referenceValue *interpreter.EphemeralReferenceValue)
func (*Context) MaybeValidateAtreeStorage ¶
func (c *Context) MaybeValidateAtreeStorage()
func (*Context) MaybeValidateAtreeValue ¶
func (*Context) MutationDuringCapabilityControllerIteration ¶
func (*Context) NewFunctionWithType ¶ added in v1.10.3
func (c *Context) NewFunctionWithType( funcValue interpreter.FunctionValue, funcStaticType interpreter.FunctionStaticType, ) interpreter.FunctionValue
NewFunctionWithType Returns a new function instance of same kind (compiled/native/bound), but with the given function type. This preferred over creating a new wrapper function kind, since all places in VM that handles function types already handle these known functions. Introducing a new kind of wrapper function means, that would need to be handled everywhere, which could be error-prone.
func (*Context) ReadStored ¶
func (c *Context) ReadStored( storageAddress common.Address, domain common.StorageDomain, identifier interpreter.StorageMapKey, ) interpreter.Value
func (*Context) RecordStorageMutation ¶
func (c *Context) RecordStorageMutation()
func (*Context) RecoverErrors ¶
func (*Context) ReferencedResourceKindedValues ¶
func (c *Context) ReferencedResourceKindedValues(valueID atree.ValueID) ReferenceSet
func (*Context) RemoveStored ¶ added in v1.9.7
func (c *Context) RemoveStored( storageAddress common.Address, domain common.StorageDomain, key interpreter.StorageMapKey, ) atree.Storable
func (*Context) SemaAccessFromStaticAuthorization ¶ added in v1.8.4
func (c *Context) SemaAccessFromStaticAuthorization(auth interpreter.Authorization) (sema.Access, error)
func (*Context) SemaTypeFromStaticType ¶
func (c *Context) SemaTypeFromStaticType(staticType interpreter.StaticType) sema.Type
func (*Context) SetAttachmentIteration ¶
func (c *Context) SetAttachmentIteration(composite *interpreter.CompositeValue, state bool) bool
func (*Context) SetCanonicalAtreeContainer ¶ added in v1.10.4
func (c *Context) SetCanonicalAtreeContainer(valueID atree.ValueID, v interpreter.Value)
func (*Context) SetInStorageIteration ¶
func (*Context) SetMutationDuringCapabilityControllerIteration ¶
func (c *Context) SetMutationDuringCapabilityControllerIteration()
func (*Context) StorageMutatedDuringIteration ¶
func (*Context) ValidateContainerMutation ¶
func (*Context) WithContainerMutationPrevention ¶
func (*Context) WithResourceDestruction ¶
func (*Context) WriteStored ¶
func (c *Context) WriteStored( storageAddress common.Address, domain common.StorageDomain, key interpreter.StorageMapKey, value interpreter.Value, ) (existed bool)
type ContractValueHandler ¶
type ContractValueHandler func( context *Context, location common.Location, ) *interpreter.CompositeValue
type ElaborationResolver ¶
type ElaborationResolver func(location common.Location) (*sema.Elaboration, error)
type EntitlementMapTypeHandlerFunc ¶
type EntitlementMapTypeHandlerFunc func(location common.Location, typeID interpreter.TypeID) *sema.EntitlementMapType
type EntitlementTypeHandlerFunc ¶
type EntitlementTypeHandlerFunc func(location common.Location, typeID interpreter.TypeID) *sema.EntitlementType
type ExecutableProgram ¶
type ExecutableProgram struct {
Location common.Location
Program *bbq.InstructionProgram
Globals []Variable
Constants []Value
StaticTypes []bbq.StaticType
}
ExecutableProgram is the 'executable' version of a `bbq.Program`. It holds information that are accessible to a given program, such as constants, static-types, and global variables. These info are accessed by the opcodes of the program. i.e: indexes used in opcodes refer to the indexes of its ExecutableProgram.
func NewExecutableProgram ¶
func NewExecutableProgram( location common.Location, program *bbq.InstructionProgram, globals []Variable, ) *ExecutableProgram
type FunctionValue ¶
type FunctionValue interface {
interpreter.FunctionValue
// HasComputedFunctionType returns whether this function has a computed function type.
//
// For most functions, the function type is pre-known/computed ahead of time.
// For example, the type of function `Integer.toBigEndianBytes()` is always `fun(): [UInt8]`.
//
// However, some functions have a type that depends on the receiver's type.
// For example, the type of the function `[T].append()` is `fun(T): Void`,
// where the parameter type `T` always depends on the receiver's type.
HasComputedFunctionType() bool
// ComputeFunctionType computes the type of the function using the provided receiver value,
// if the function has a computed type.
// This function panics if the function does not have a computed function type.
// Use `HasComputedFunctionType` to determine whether this method should be called or not.
ComputeFunctionType(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
IsNative() bool
}
type ImplicitReferenceValue ¶
type ImplicitReferenceValue struct {
// contains filtered or unexported fields
}
func NewImplicitReferenceValue ¶
func NewImplicitReferenceValue(context interpreter.ReferenceCreationContext, value Value) ImplicitReferenceValue
func (ImplicitReferenceValue) Accept ¶
func (v ImplicitReferenceValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
func (ImplicitReferenceValue) Clone ¶
func (v ImplicitReferenceValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
func (ImplicitReferenceValue) ConformsToStaticType ¶
func (v ImplicitReferenceValue) ConformsToStaticType( _ interpreter.ValueStaticTypeConformanceContext, _ interpreter.TypeConformanceResults, ) bool
func (ImplicitReferenceValue) DeepRemove ¶
func (v ImplicitReferenceValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
func (ImplicitReferenceValue) GetAuthorization ¶
func (v ImplicitReferenceValue) GetAuthorization() interpreter.Authorization
func (ImplicitReferenceValue) IsImportable ¶
func (v ImplicitReferenceValue) IsImportable(_ interpreter.ValueImportableContext) bool
func (ImplicitReferenceValue) IsResourceKinded ¶
func (v ImplicitReferenceValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
func (ImplicitReferenceValue) IsValue ¶
func (v ImplicitReferenceValue) IsValue()
func (ImplicitReferenceValue) MeteredString ¶
func (v ImplicitReferenceValue) MeteredString( _ interpreter.ValueStringContext, _ interpreter.SeenReferences, ) string
func (ImplicitReferenceValue) NeedsStoreTo ¶
func (v ImplicitReferenceValue) NeedsStoreTo(_ atree.Address) bool
func (ImplicitReferenceValue) RecursiveString ¶
func (v ImplicitReferenceValue) RecursiveString(_ interpreter.SeenReferences) string
func (ImplicitReferenceValue) ReferencedValue ¶
func (v ImplicitReferenceValue) ReferencedValue( context interpreter.ValueStaticTypeContext, ) interpreter.Value
func (ImplicitReferenceValue) StaticType ¶
func (v ImplicitReferenceValue) StaticType(_ interpreter.ValueStaticTypeContext) interpreter.StaticType
func (ImplicitReferenceValue) Storable ¶
func (v ImplicitReferenceValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
func (ImplicitReferenceValue) String ¶
func (v ImplicitReferenceValue) String() string
func (ImplicitReferenceValue) Transfer ¶
func (v ImplicitReferenceValue) Transfer( _ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, _ map[atree.ValueID]struct{}, _ bool, ) interpreter.Value
func (ImplicitReferenceValue) Walk ¶
func (v ImplicitReferenceValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
type IteratorWrapperValue ¶
type IteratorWrapperValue struct {
interpreter.ValueIterator
}
func NewIteratorWrapperValue ¶
func NewIteratorWrapperValue(iterator interpreter.ValueIterator) *IteratorWrapperValue
func (IteratorWrapperValue) Accept ¶
func (v IteratorWrapperValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
func (IteratorWrapperValue) Clone ¶
func (v IteratorWrapperValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
func (IteratorWrapperValue) ConformsToStaticType ¶
func (v IteratorWrapperValue) ConformsToStaticType( _ interpreter.ValueStaticTypeConformanceContext, _ interpreter.TypeConformanceResults, ) bool
func (IteratorWrapperValue) DeepRemove ¶
func (v IteratorWrapperValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
func (IteratorWrapperValue) IsImportable ¶
func (v IteratorWrapperValue) IsImportable(_ interpreter.ValueImportableContext) bool
func (IteratorWrapperValue) IsResourceKinded ¶
func (v IteratorWrapperValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
func (IteratorWrapperValue) IsValue ¶
func (v IteratorWrapperValue) IsValue()
func (IteratorWrapperValue) MeteredString ¶
func (v IteratorWrapperValue) MeteredString( _ interpreter.ValueStringContext, _ interpreter.SeenReferences, ) string
func (IteratorWrapperValue) NeedsStoreTo ¶
func (v IteratorWrapperValue) NeedsStoreTo(_ atree.Address) bool
func (IteratorWrapperValue) RecursiveString ¶
func (v IteratorWrapperValue) RecursiveString(_ interpreter.SeenReferences) string
func (IteratorWrapperValue) StaticType ¶
func (v IteratorWrapperValue) StaticType(_ interpreter.ValueStaticTypeContext) interpreter.StaticType
func (IteratorWrapperValue) Storable ¶
func (v IteratorWrapperValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
func (IteratorWrapperValue) String ¶
func (v IteratorWrapperValue) String() string
func (IteratorWrapperValue) Transfer ¶
func (v IteratorWrapperValue) Transfer( _ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, _ map[atree.ValueID]struct{}, _ bool, ) interpreter.Value
func (IteratorWrapperValue) Walk ¶
func (v IteratorWrapperValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
type LinkedGlobals ¶
type LinkedGlobals struct {
// contains filtered or unexported fields
}
func LinkGlobals ¶
func LinkGlobals( memoryGauge common.MemoryGauge, location common.Location, program *bbq.InstructionProgram, context *Context, linkedGlobalsCache map[common.Location]LinkedGlobals, ) LinkedGlobals
LinkGlobals performs the linking of global functions and variables for a given program.
type LinkerError ¶
type LinkerError struct {
Message string
}
func (LinkerError) Error ¶
func (l LinkerError) Error() string
func (LinkerError) IsInternalError ¶
func (l LinkerError) IsInternalError()
type NativeFunctionValue ¶
type NativeFunctionValue struct {
Name string
Function interpreter.NativeFunction
// contains filtered or unexported fields
}
func NewNativeFunctionValue ¶
func NewNativeFunctionValue( name string, funcType *sema.FunctionType, fn interpreter.NativeFunction, ) *NativeFunctionValue
func NewNativeFunctionValueWithDerivedType ¶
func NewNativeFunctionValueWithDerivedType( name string, typeGetter func(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType, fn interpreter.NativeFunction, ) *NativeFunctionValue
func (*NativeFunctionValue) Accept ¶
func (v *NativeFunctionValue) Accept(_ interpreter.ValueVisitContext, _ interpreter.Visitor)
func (*NativeFunctionValue) Clone ¶
func (v *NativeFunctionValue) Clone(_ interpreter.ValueCloneContext) interpreter.Value
func (*NativeFunctionValue) ComputeFunctionType ¶ added in v1.10.3
func (v *NativeFunctionValue) ComputeFunctionType(receiver Value, context interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*NativeFunctionValue) ConformsToStaticType ¶
func (v *NativeFunctionValue) ConformsToStaticType( _ interpreter.ValueStaticTypeConformanceContext, _ interpreter.TypeConformanceResults, ) bool
func (*NativeFunctionValue) DeepRemove ¶
func (v *NativeFunctionValue) DeepRemove(_ interpreter.ValueRemoveContext, _ bool)
func (*NativeFunctionValue) DereferenceReceiver ¶ added in v1.10.3
func (v *NativeFunctionValue) DereferenceReceiver() bool
func (*NativeFunctionValue) FunctionType ¶
func (v *NativeFunctionValue) FunctionType(interpreter.ValueStaticTypeContext) *sema.FunctionType
func (*NativeFunctionValue) GetMember ¶
func (v *NativeFunctionValue) GetMember( context interpreter.MemberAccessibleContext, name string, memberKind common.DeclarationKind, accessedReference interpreter.ReferenceValue, ) interpreter.Value
func (*NativeFunctionValue) GetMethod ¶
func (v *NativeFunctionValue) GetMethod( _ interpreter.MemberAccessibleContext, _ string, _ interpreter.ReferenceValue, ) interpreter.FunctionValue
func (*NativeFunctionValue) HasComputedFunctionType ¶ added in v1.10.3
func (v *NativeFunctionValue) HasComputedFunctionType() bool
func (*NativeFunctionValue) Invoke ¶
func (v *NativeFunctionValue) Invoke(invocation interpreter.Invocation) interpreter.Value
func (*NativeFunctionValue) IsFunctionValue ¶
func (v *NativeFunctionValue) IsFunctionValue()
func (*NativeFunctionValue) IsImportable ¶
func (v *NativeFunctionValue) IsImportable(_ interpreter.ValueImportableContext) bool
func (*NativeFunctionValue) IsNative ¶
func (v *NativeFunctionValue) IsNative() bool
func (*NativeFunctionValue) IsResourceKinded ¶
func (v *NativeFunctionValue) IsResourceKinded(_ interpreter.ValueStaticTypeContext) bool
func (*NativeFunctionValue) IsValue ¶
func (*NativeFunctionValue) IsValue()
func (*NativeFunctionValue) MeteredString ¶
func (v *NativeFunctionValue) MeteredString( context interpreter.ValueStringContext, _ interpreter.SeenReferences, ) string
func (*NativeFunctionValue) NeedsStoreTo ¶
func (v *NativeFunctionValue) NeedsStoreTo(_ atree.Address) bool
func (*NativeFunctionValue) RecursiveString ¶
func (v *NativeFunctionValue) RecursiveString(_ interpreter.SeenReferences) string
func (*NativeFunctionValue) RemoveMember ¶
func (*NativeFunctionValue) RemoveMember(_ interpreter.ValueTransferContext, _ string) interpreter.Value
func (*NativeFunctionValue) SetMember ¶
func (*NativeFunctionValue) SetMember(_ interpreter.ValueTransferContext, _ string, _ interpreter.Value) bool
func (*NativeFunctionValue) StaticType ¶
func (v *NativeFunctionValue) StaticType(context interpreter.ValueStaticTypeContext) bbq.StaticType
func (*NativeFunctionValue) Storable ¶
func (v *NativeFunctionValue) Storable(_ atree.SlabStorage, _ atree.Address, _ uint32) (atree.Storable, error)
func (*NativeFunctionValue) String ¶
func (v *NativeFunctionValue) String() string
func (*NativeFunctionValue) Transfer ¶
func (v *NativeFunctionValue) Transfer( _ interpreter.ValueTransferContext, _ atree.Address, _ bool, _ atree.Storable, _ map[atree.ValueID]struct{}, _ bool, ) interpreter.Value
func (*NativeFunctionValue) Walk ¶
func (v *NativeFunctionValue) Walk(_ interpreter.ValueWalkContext, _ func(interpreter.Value))
func (*NativeFunctionValue) WithDereferenceReceiver ¶ added in v1.10.3
func (v *NativeFunctionValue) WithDereferenceReceiver(dereferenceReceiver bool) *NativeFunctionValue
type ReferenceSet ¶ added in v1.8.4
type ReferenceSet = map[*interpreter.EphemeralReferenceValue]struct{}
type ReferencedResourceKindedValues ¶
type ReferencedResourceKindedValues map[atree.ValueID]ReferenceSet
type UnknownFunctionError ¶
type UnknownFunctionError struct {
// contains filtered or unexported fields
}
UnknownFunctionError
func (UnknownFunctionError) Error ¶
func (e UnknownFunctionError) Error() string
func (UnknownFunctionError) IsUserError ¶
func (UnknownFunctionError) IsUserError()
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
func (*VM) InitializeContract ¶
func (vm *VM) InitializeContract(contractName string, arguments ...Value) (*interpreter.CompositeValue, error)
func (*VM) InvokeExternally ¶
InvokeExternally invokes a global function with the given arguments
func (*VM) InvokeExternallyUncheckedForTestingOnly
deprecated
added in
v1.9.7
func (*VM) InvokeMethodExternally ¶
func (vm *VM) InvokeMethodExternally( name string, receiver interpreter.MemberAccessibleValue, arguments ...Value, ) ( v Value, err error, )
func (*VM) InvokeTransaction ¶
func (*VM) InvokeTransactionExecute ¶
func (vm *VM) InvokeTransactionExecute(transaction *interpreter.SimpleCompositeValue) error
func (*VM) InvokeTransactionInit ¶
func (*VM) InvokeTransactionPrepare ¶
func (vm *VM) InvokeTransactionPrepare(transaction *interpreter.SimpleCompositeValue, signers []Value) error
func (*VM) InvokeTransactionWrapper ¶
func (vm *VM) InvokeTransactionWrapper() (*interpreter.SimpleCompositeValue, error)
func (*VM) LocationRange ¶
func (vm *VM) LocationRange() interpreter.LocationRange
LocationRange returns the location of the currently executing instruction. This is an expensive operation and must be only used on-demand.
func (*VM) RecoverErrors ¶
type VMArgumentTypesIterator ¶ added in v1.9.5
type VMArgumentTypesIterator struct {
// contains filtered or unexported fields
}
func NewVMArgumentTypesIterator ¶ added in v1.9.5
func NewVMArgumentTypesIterator(context *Context, argumentTypes []bbq.StaticType) *VMArgumentTypesIterator
func (*VMArgumentTypesIterator) NextSema ¶ added in v1.9.5
func (g *VMArgumentTypesIterator) NextSema() sema.Type
func (*VMArgumentTypesIterator) NextStatic ¶ added in v1.9.5
func (g *VMArgumentTypesIterator) NextStatic() interpreter.StaticType
type VMTypeArgumentsIterator ¶ added in v1.8.0
type VMTypeArgumentsIterator struct {
// contains filtered or unexported fields
}
func NewVMTypeArgumentsIterator ¶ added in v1.8.0
func NewVMTypeArgumentsIterator(context *Context, typeArguments []bbq.StaticType) *VMTypeArgumentsIterator
func (*VMTypeArgumentsIterator) NextSema ¶ added in v1.8.0
func (g *VMTypeArgumentsIterator) NextSema() sema.Type
func (*VMTypeArgumentsIterator) NextStatic ¶ added in v1.8.0
func (g *VMTypeArgumentsIterator) NextStatic() interpreter.StaticType
type Value ¶
type Value = interpreter.Value
func ConvertAndBox ¶
func ConvertAndBox( context *Context, value Value, targetType bbq.StaticType, ) Value
ConvertAndBox converts a value to a target type, and boxes in optionals and any value, if necessary. Here `staticValueType` is the statically known type of the value, not the dynamic type of the value.
func ConvertAndBoxWithValidation ¶ added in v1.9.7
func ConvertAndBoxWithValidation( context *Context, value Value, staticValueType, targetType bbq.StaticType, ) Value
ConvertAndBoxWithValidation converts a value to a target type, and boxes in optionals and any value, if necessary. Here `staticValueType` is the statically known type of the value, not the dynamic type of the value.
type Variable ¶
type Variable = interpreter.Variable
Source Files
¶
- builtin_globals.go
- callframe.go
- config.go
- context.go
- errors.go
- executable_program.go
- linker.go
- native_function.go
- reference_tracking.go
- tracinginfo_disabled.go
- types.go
- upvalue.go
- value.go
- value_account_storage.go
- value_accountcapabilitycontroller.go
- value_address.go
- value_array.go
- value_capability.go
- value_character.go
- value_composite.go
- value_deployedcontract.go
- value_dictionary.go
- value_function.go
- value_implicit_reference.go
- value_inclusiverange.go
- value_int.go
- value_iterator.go
- value_number.go
- value_optional.go
- value_path.go
- value_storagecapabilitycontroller.go
- value_string.go
- value_stringbuilder.go
- value_type.go
- value_ufix64.go
- value_uint64.go
- vm.go