core: remove interop methods from interopContext
If interops are defined as a separate functions they can be implemented in a separate packages which can help us to structure core.
This commit is contained in:
parent
6d9c59f7fe
commit
efddcf3bfe
7 changed files with 390 additions and 389 deletions
|
@ -37,7 +37,7 @@ const (
|
|||
)
|
||||
|
||||
// headerGetVersion returns version from the header.
|
||||
func (ic *interopContext) headerGetVersion(v *vm.VM) error {
|
||||
func headerGetVersion(ic *interopContext, v *vm.VM) error {
|
||||
header, err := popHeaderFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -47,7 +47,7 @@ func (ic *interopContext) headerGetVersion(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// headerGetConsensusData returns consensus data from the header.
|
||||
func (ic *interopContext) headerGetConsensusData(v *vm.VM) error {
|
||||
func headerGetConsensusData(ic *interopContext, v *vm.VM) error {
|
||||
header, err := popHeaderFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -57,7 +57,7 @@ func (ic *interopContext) headerGetConsensusData(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// headerGetMerkleRoot returns version from the header.
|
||||
func (ic *interopContext) headerGetMerkleRoot(v *vm.VM) error {
|
||||
func headerGetMerkleRoot(ic *interopContext, v *vm.VM) error {
|
||||
header, err := popHeaderFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -67,7 +67,7 @@ func (ic *interopContext) headerGetMerkleRoot(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// headerGetNextConsensus returns version from the header.
|
||||
func (ic *interopContext) headerGetNextConsensus(v *vm.VM) error {
|
||||
func headerGetNextConsensus(ic *interopContext, v *vm.VM) error {
|
||||
header, err := popHeaderFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -77,7 +77,7 @@ func (ic *interopContext) headerGetNextConsensus(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetAttributes returns current transaction attributes.
|
||||
func (ic *interopContext) txGetAttributes(v *vm.VM) error {
|
||||
func txGetAttributes(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -95,7 +95,7 @@ func (ic *interopContext) txGetAttributes(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetInputs returns current transaction inputs.
|
||||
func (ic *interopContext) txGetInputs(v *vm.VM) error {
|
||||
func txGetInputs(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -113,7 +113,7 @@ func (ic *interopContext) txGetInputs(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetOutputs returns current transaction outputs.
|
||||
func (ic *interopContext) txGetOutputs(v *vm.VM) error {
|
||||
func txGetOutputs(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -131,7 +131,7 @@ func (ic *interopContext) txGetOutputs(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetReferences returns current transaction references.
|
||||
func (ic *interopContext) txGetReferences(v *vm.VM) error {
|
||||
func txGetReferences(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -159,7 +159,7 @@ func (ic *interopContext) txGetReferences(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetType returns current transaction type.
|
||||
func (ic *interopContext) txGetType(v *vm.VM) error {
|
||||
func txGetType(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -170,7 +170,7 @@ func (ic *interopContext) txGetType(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetUnspentCoins returns current transaction unspent coins.
|
||||
func (ic *interopContext) txGetUnspentCoins(v *vm.VM) error {
|
||||
func txGetUnspentCoins(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -185,7 +185,7 @@ func (ic *interopContext) txGetUnspentCoins(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// txGetWitnesses returns current transaction witnesses.
|
||||
func (ic *interopContext) txGetWitnesses(v *vm.VM) error {
|
||||
func txGetWitnesses(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -203,7 +203,7 @@ func (ic *interopContext) txGetWitnesses(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// invocationTx_GetScript returns invocation script from the current transaction.
|
||||
func (ic *interopContext) invocationTxGetScript(v *vm.VM) error {
|
||||
func invocationTxGetScript(ic *interopContext, v *vm.VM) error {
|
||||
txInterface := v.Estack().Pop().Value()
|
||||
tx, ok := txInterface.(*transaction.Transaction)
|
||||
if !ok {
|
||||
|
@ -221,7 +221,7 @@ func (ic *interopContext) invocationTxGetScript(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// witnessGetVerificationScript returns current witness' script.
|
||||
func (ic *interopContext) witnessGetVerificationScript(v *vm.VM) error {
|
||||
func witnessGetVerificationScript(ic *interopContext, v *vm.VM) error {
|
||||
witInterface := v.Estack().Pop().Value()
|
||||
wit, ok := witInterface.(*transaction.Witness)
|
||||
if !ok {
|
||||
|
@ -235,7 +235,7 @@ func (ic *interopContext) witnessGetVerificationScript(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// bcGetValidators returns validators.
|
||||
func (ic *interopContext) bcGetValidators(v *vm.VM) error {
|
||||
func bcGetValidators(ic *interopContext, v *vm.VM) error {
|
||||
validators := ic.dao.GetValidators()
|
||||
v.Estack().PushVal(validators)
|
||||
return nil
|
||||
|
@ -256,7 +256,7 @@ func popInputFromVM(v *vm.VM) (*transaction.Input, error) {
|
|||
}
|
||||
|
||||
// inputGetHash returns hash from the given input.
|
||||
func (ic *interopContext) inputGetHash(v *vm.VM) error {
|
||||
func inputGetHash(ic *interopContext, v *vm.VM) error {
|
||||
input, err := popInputFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -266,7 +266,7 @@ func (ic *interopContext) inputGetHash(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// inputGetIndex returns index from the given input.
|
||||
func (ic *interopContext) inputGetIndex(v *vm.VM) error {
|
||||
func inputGetIndex(ic *interopContext, v *vm.VM) error {
|
||||
input, err := popInputFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -290,7 +290,7 @@ func popOutputFromVM(v *vm.VM) (*transaction.Output, error) {
|
|||
}
|
||||
|
||||
// outputGetAssetId returns asset ID from the given output.
|
||||
func (ic *interopContext) outputGetAssetID(v *vm.VM) error {
|
||||
func outputGetAssetID(ic *interopContext, v *vm.VM) error {
|
||||
output, err := popOutputFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -300,7 +300,7 @@ func (ic *interopContext) outputGetAssetID(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// outputGetScriptHash returns scripthash from the given output.
|
||||
func (ic *interopContext) outputGetScriptHash(v *vm.VM) error {
|
||||
func outputGetScriptHash(ic *interopContext, v *vm.VM) error {
|
||||
output, err := popOutputFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -310,7 +310,7 @@ func (ic *interopContext) outputGetScriptHash(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// outputGetValue returns value (amount) from the given output.
|
||||
func (ic *interopContext) outputGetValue(v *vm.VM) error {
|
||||
func outputGetValue(ic *interopContext, v *vm.VM) error {
|
||||
output, err := popOutputFromVM(v)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -320,7 +320,7 @@ func (ic *interopContext) outputGetValue(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// attrGetData returns tx attribute data.
|
||||
func (ic *interopContext) attrGetData(v *vm.VM) error {
|
||||
func attrGetData(ic *interopContext, v *vm.VM) error {
|
||||
attrInterface := v.Estack().Pop().Value()
|
||||
attr, ok := attrInterface.(*transaction.Attribute)
|
||||
if !ok {
|
||||
|
@ -331,7 +331,7 @@ func (ic *interopContext) attrGetData(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// attrGetData returns tx attribute usage field.
|
||||
func (ic *interopContext) attrGetUsage(v *vm.VM) error {
|
||||
func attrGetUsage(ic *interopContext, v *vm.VM) error {
|
||||
attrInterface := v.Estack().Pop().Value()
|
||||
attr, ok := attrInterface.(*transaction.Attribute)
|
||||
if !ok {
|
||||
|
@ -342,7 +342,7 @@ func (ic *interopContext) attrGetUsage(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// bcGetAccount returns or creates an account.
|
||||
func (ic *interopContext) bcGetAccount(v *vm.VM) error {
|
||||
func bcGetAccount(ic *interopContext, v *vm.VM) error {
|
||||
accbytes := v.Estack().Pop().Bytes()
|
||||
acchash, err := util.Uint160DecodeBytesBE(accbytes)
|
||||
if err != nil {
|
||||
|
@ -357,7 +357,7 @@ func (ic *interopContext) bcGetAccount(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// bcGetAsset returns an asset.
|
||||
func (ic *interopContext) bcGetAsset(v *vm.VM) error {
|
||||
func bcGetAsset(ic *interopContext, v *vm.VM) error {
|
||||
asbytes := v.Estack().Pop().Bytes()
|
||||
ashash, err := util.Uint256DecodeBytesBE(asbytes)
|
||||
if err != nil {
|
||||
|
@ -372,7 +372,7 @@ func (ic *interopContext) bcGetAsset(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// accountGetBalance returns balance for a given account.
|
||||
func (ic *interopContext) accountGetBalance(v *vm.VM) error {
|
||||
func accountGetBalance(ic *interopContext, v *vm.VM) error {
|
||||
accInterface := v.Estack().Pop().Value()
|
||||
acc, ok := accInterface.(*state.Account)
|
||||
if !ok {
|
||||
|
@ -392,7 +392,7 @@ func (ic *interopContext) accountGetBalance(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// accountGetScriptHash returns script hash of a given account.
|
||||
func (ic *interopContext) accountGetScriptHash(v *vm.VM) error {
|
||||
func accountGetScriptHash(ic *interopContext, v *vm.VM) error {
|
||||
accInterface := v.Estack().Pop().Value()
|
||||
acc, ok := accInterface.(*state.Account)
|
||||
if !ok {
|
||||
|
@ -403,7 +403,7 @@ func (ic *interopContext) accountGetScriptHash(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// accountGetVotes returns votes of a given account.
|
||||
func (ic *interopContext) accountGetVotes(v *vm.VM) error {
|
||||
func accountGetVotes(ic *interopContext, v *vm.VM) error {
|
||||
accInterface := v.Estack().Pop().Value()
|
||||
acc, ok := accInterface.(*state.Account)
|
||||
if !ok {
|
||||
|
@ -421,7 +421,7 @@ func (ic *interopContext) accountGetVotes(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// accountIsStandard checks whether given account is standard.
|
||||
func (ic *interopContext) accountIsStandard(v *vm.VM) error {
|
||||
func accountIsStandard(ic *interopContext, v *vm.VM) error {
|
||||
accbytes := v.Estack().Pop().Bytes()
|
||||
acchash, err := util.Uint160DecodeBytesBE(accbytes)
|
||||
if err != nil {
|
||||
|
@ -434,13 +434,13 @@ func (ic *interopContext) accountIsStandard(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// storageFind finds stored key-value pair.
|
||||
func (ic *interopContext) storageFind(v *vm.VM) error {
|
||||
func storageFind(ic *interopContext, v *vm.VM) error {
|
||||
stcInterface := v.Estack().Pop().Value()
|
||||
stc, ok := stcInterface.(*StorageContext)
|
||||
if !ok {
|
||||
return fmt.Errorf("%T is not a StorageContext", stcInterface)
|
||||
}
|
||||
err := ic.checkStorageContext(stc)
|
||||
err := checkStorageContext(ic, stc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ func (ic *interopContext) storageFind(v *vm.VM) error {
|
|||
// createContractStateFromVM pops all contract state elements from the VM
|
||||
// evaluation stack, does a lot of checks and returns Contract if it
|
||||
// succeeds.
|
||||
func (ic *interopContext) createContractStateFromVM(v *vm.VM) (*state.Contract, error) {
|
||||
func createContractStateFromVM(ic *interopContext, v *vm.VM) (*state.Contract, error) {
|
||||
if ic.trigger != trigger.Application {
|
||||
return nil, errors.New("can't create contract when not triggered by an application")
|
||||
}
|
||||
|
@ -520,8 +520,8 @@ func (ic *interopContext) createContractStateFromVM(v *vm.VM) (*state.Contract,
|
|||
}
|
||||
|
||||
// contractCreate creates a contract.
|
||||
func (ic *interopContext) contractCreate(v *vm.VM) error {
|
||||
newcontract, err := ic.createContractStateFromVM(v)
|
||||
func contractCreate(ic *interopContext, v *vm.VM) error {
|
||||
newcontract, err := createContractStateFromVM(ic, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ func (ic *interopContext) contractCreate(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// contractGetScript returns a script associated with a contract.
|
||||
func (ic *interopContext) contractGetScript(v *vm.VM) error {
|
||||
func contractGetScript(ic *interopContext, v *vm.VM) error {
|
||||
csInterface := v.Estack().Pop().Value()
|
||||
cs, ok := csInterface.(*state.Contract)
|
||||
if !ok {
|
||||
|
@ -549,7 +549,7 @@ func (ic *interopContext) contractGetScript(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// contractIsPayable returns whether contract is payable.
|
||||
func (ic *interopContext) contractIsPayable(v *vm.VM) error {
|
||||
func contractIsPayable(ic *interopContext, v *vm.VM) error {
|
||||
csInterface := v.Estack().Pop().Value()
|
||||
cs, ok := csInterface.(*state.Contract)
|
||||
if !ok {
|
||||
|
@ -560,8 +560,8 @@ func (ic *interopContext) contractIsPayable(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// contractMigrate migrates a contract.
|
||||
func (ic *interopContext) contractMigrate(v *vm.VM) error {
|
||||
newcontract, err := ic.createContractStateFromVM(v)
|
||||
func contractMigrate(ic *interopContext, v *vm.VM) error {
|
||||
newcontract, err := createContractStateFromVM(ic, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -588,11 +588,11 @@ func (ic *interopContext) contractMigrate(v *vm.VM) error {
|
|||
}
|
||||
}
|
||||
v.Estack().PushVal(vm.NewInteropItem(contract))
|
||||
return ic.contractDestroy(v)
|
||||
return contractDestroy(ic, v)
|
||||
}
|
||||
|
||||
// assetCreate creates an asset.
|
||||
func (ic *interopContext) assetCreate(v *vm.VM) error {
|
||||
func assetCreate(ic *interopContext, v *vm.VM) error {
|
||||
if ic.trigger != trigger.Application {
|
||||
return errors.New("can't create asset when not triggered by an application")
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ func (ic *interopContext) assetCreate(v *vm.VM) error {
|
|||
if owner.IsInfinity() {
|
||||
return errors.New("can't have infinity as an owner key")
|
||||
}
|
||||
witnessOk, err := ic.checkKeyedWitness(owner)
|
||||
witnessOk, err := checkKeyedWitness(ic, owner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ func (ic *interopContext) assetCreate(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetAdmin returns asset admin.
|
||||
func (ic *interopContext) assetGetAdmin(v *vm.VM) error {
|
||||
func assetGetAdmin(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -681,7 +681,7 @@ func (ic *interopContext) assetGetAdmin(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetAmount returns the overall amount of asset available.
|
||||
func (ic *interopContext) assetGetAmount(v *vm.VM) error {
|
||||
func assetGetAmount(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -692,7 +692,7 @@ func (ic *interopContext) assetGetAmount(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetAssetId returns the id of an asset.
|
||||
func (ic *interopContext) assetGetAssetID(v *vm.VM) error {
|
||||
func assetGetAssetID(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -703,7 +703,7 @@ func (ic *interopContext) assetGetAssetID(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetAssetType returns type of an asset.
|
||||
func (ic *interopContext) assetGetAssetType(v *vm.VM) error {
|
||||
func assetGetAssetType(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -714,7 +714,7 @@ func (ic *interopContext) assetGetAssetType(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetAvailable returns available (not yet issued) amount of asset.
|
||||
func (ic *interopContext) assetGetAvailable(v *vm.VM) error {
|
||||
func assetGetAvailable(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -725,7 +725,7 @@ func (ic *interopContext) assetGetAvailable(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetIssuer returns issuer of an asset.
|
||||
func (ic *interopContext) assetGetIssuer(v *vm.VM) error {
|
||||
func assetGetIssuer(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -736,7 +736,7 @@ func (ic *interopContext) assetGetIssuer(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetOwner returns owner of an asset.
|
||||
func (ic *interopContext) assetGetOwner(v *vm.VM) error {
|
||||
func assetGetOwner(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -747,7 +747,7 @@ func (ic *interopContext) assetGetOwner(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetGetPrecision returns precision used to measure this asset.
|
||||
func (ic *interopContext) assetGetPrecision(v *vm.VM) error {
|
||||
func assetGetPrecision(ic *interopContext, v *vm.VM) error {
|
||||
asInterface := v.Estack().Pop().Value()
|
||||
as, ok := asInterface.(*state.Asset)
|
||||
if !ok {
|
||||
|
@ -758,7 +758,7 @@ func (ic *interopContext) assetGetPrecision(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// assetRenew updates asset expiration date.
|
||||
func (ic *interopContext) assetRenew(v *vm.VM) error {
|
||||
func assetRenew(ic *interopContext, v *vm.VM) error {
|
||||
if ic.trigger != trigger.Application {
|
||||
return errors.New("can't create asset when not triggered by an application")
|
||||
}
|
||||
|
@ -790,57 +790,57 @@ func (ic *interopContext) assetRenew(v *vm.VM) error {
|
|||
}
|
||||
|
||||
// runtimeSerialize serializes top stack item into a ByteArray.
|
||||
func (ic *interopContext) runtimeSerialize(v *vm.VM) error {
|
||||
func runtimeSerialize(_ *interopContext, v *vm.VM) error {
|
||||
return vm.RuntimeSerialize(v)
|
||||
}
|
||||
|
||||
// runtimeDeserialize deserializes ByteArray from a stack into an item.
|
||||
func (ic *interopContext) runtimeDeserialize(v *vm.VM) error {
|
||||
func runtimeDeserialize(_ *interopContext, v *vm.VM) error {
|
||||
return vm.RuntimeDeserialize(v)
|
||||
}
|
||||
|
||||
// enumeratorConcat concatenates 2 enumerators into a single one.
|
||||
func (ic *interopContext) enumeratorConcat(v *vm.VM) error {
|
||||
func enumeratorConcat(_ *interopContext, v *vm.VM) error {
|
||||
return vm.EnumeratorConcat(v)
|
||||
}
|
||||
|
||||
// enumeratorCreate creates an enumerator from an array-like stack item.
|
||||
func (ic *interopContext) enumeratorCreate(v *vm.VM) error {
|
||||
func enumeratorCreate(_ *interopContext, v *vm.VM) error {
|
||||
return vm.EnumeratorCreate(v)
|
||||
}
|
||||
|
||||
// enumeratorNext advances the enumerator, pushes true if is it was successful
|
||||
// and false otherwise.
|
||||
func (ic *interopContext) enumeratorNext(v *vm.VM) error {
|
||||
func enumeratorNext(_ *interopContext, v *vm.VM) error {
|
||||
return vm.EnumeratorNext(v)
|
||||
}
|
||||
|
||||
// enumeratorValue returns the current value of the enumerator.
|
||||
func (ic *interopContext) enumeratorValue(v *vm.VM) error {
|
||||
func enumeratorValue(_ *interopContext, v *vm.VM) error {
|
||||
return vm.EnumeratorValue(v)
|
||||
}
|
||||
|
||||
// iteratorConcat concatenates 2 iterators into a single one.
|
||||
func (ic *interopContext) iteratorConcat(v *vm.VM) error {
|
||||
func iteratorConcat(_ *interopContext, v *vm.VM) error {
|
||||
return vm.IteratorConcat(v)
|
||||
}
|
||||
|
||||
// iteratorCreate creates an iterator from array-like or map stack item.
|
||||
func (ic *interopContext) iteratorCreate(v *vm.VM) error {
|
||||
func iteratorCreate(_ *interopContext, v *vm.VM) error {
|
||||
return vm.IteratorCreate(v)
|
||||
}
|
||||
|
||||
// iteratorKey returns current iterator key.
|
||||
func (ic *interopContext) iteratorKey(v *vm.VM) error {
|
||||
func iteratorKey(_ *interopContext, v *vm.VM) error {
|
||||
return vm.IteratorKey(v)
|
||||
}
|
||||
|
||||
// iteratorKeys returns keys of the iterator.
|
||||
func (ic *interopContext) iteratorKeys(v *vm.VM) error {
|
||||
func iteratorKeys(_ *interopContext, v *vm.VM) error {
|
||||
return vm.IteratorKeys(v)
|
||||
}
|
||||
|
||||
// iteratorValues returns values of the iterator.
|
||||
func (ic *interopContext) iteratorValues(v *vm.VM) error {
|
||||
func iteratorValues(_ *interopContext, v *vm.VM) error {
|
||||
return vm.IteratorValues(v)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue