-
Notifications
You must be signed in to change notification settings - Fork 178
/
runtime.go
90 lines (70 loc) · 3.3 KB
/
runtime.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package testutil
import (
"github.com/onflow/cadence"
"github.com/onflow/cadence/runtime"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/interpreter"
"github.com/onflow/cadence/runtime/sema"
)
var _ runtime.Runtime = &TestInterpreterRuntime{}
type TestInterpreterRuntime struct {
ReadStoredFunc func(address common.Address, path cadence.Path, context runtime.Context) (cadence.Value, error)
InvokeContractFunc func(a common.AddressLocation, s string, values []cadence.Value, types []sema.Type, ctx runtime.Context) (cadence.Value, error)
}
func (t *TestInterpreterRuntime) NewScriptExecutor(script runtime.Script, context runtime.Context) runtime.Executor {
panic("NewScriptExecutor not defined")
}
func (t *TestInterpreterRuntime) NewTransactionExecutor(script runtime.Script, context runtime.Context) runtime.Executor {
panic("NewTransactionExecutor not defined")
}
func (t *TestInterpreterRuntime) NewContractFunctionExecutor(contractLocation common.AddressLocation, functionName string, arguments []cadence.Value, argumentTypes []sema.Type, context runtime.Context) runtime.Executor {
panic("NewContractFunctionExecutor not defined")
}
func (t *TestInterpreterRuntime) SetDebugger(debugger *interpreter.Debugger) {
panic("SetDebugger not defined")
}
func (t *TestInterpreterRuntime) ExecuteScript(runtime.Script, runtime.Context) (cadence.Value, error) {
panic("ExecuteScript not defined")
}
func (t *TestInterpreterRuntime) ExecuteTransaction(runtime.Script, runtime.Context) error {
panic("ExecuteTransaction not defined")
}
func (t *TestInterpreterRuntime) InvokeContractFunction(a common.AddressLocation, s string, values []cadence.Value, types []sema.Type, ctx runtime.Context) (cadence.Value, error) {
if t.InvokeContractFunc == nil {
panic("InvokeContractFunction not defined")
}
return t.InvokeContractFunc(a, s, values, types, ctx)
}
func (t *TestInterpreterRuntime) ParseAndCheckProgram([]byte, runtime.Context) (*interpreter.Program, error) {
panic("ParseAndCheckProgram not defined")
}
func (t *TestInterpreterRuntime) SetCoverageReport(*runtime.CoverageReport) {
panic("SetCoverageReport not defined")
}
func (t *TestInterpreterRuntime) SetContractUpdateValidationEnabled(bool) {
panic("SetContractUpdateValidationEnabled not defined")
}
func (t *TestInterpreterRuntime) SetAtreeValidationEnabled(bool) {
panic("SetAtreeValidationEnabled not defined")
}
func (t *TestInterpreterRuntime) SetTracingEnabled(bool) {
panic("SetTracingEnabled not defined")
}
func (t *TestInterpreterRuntime) SetInvalidatedResourceValidationEnabled(bool) {
panic("SetInvalidatedResourceValidationEnabled not defined")
}
func (t *TestInterpreterRuntime) SetResourceOwnerChangeHandlerEnabled(bool) {
panic("SetResourceOwnerChangeHandlerEnabled not defined")
}
func (t *TestInterpreterRuntime) ReadStored(address common.Address, path cadence.Path, context runtime.Context) (cadence.Value, error) {
if t.ReadStoredFunc == nil {
panic("ReadStored not defined")
}
return t.ReadStoredFunc(address, path, context)
}
func (t *TestInterpreterRuntime) ReadLinked(common.Address, cadence.Path, runtime.Context) (cadence.Value, error) {
panic("ReadLinked not defined")
}
func (*TestInterpreterRuntime) Storage(runtime.Context) (*runtime.Storage, *interpreter.Interpreter, error) {
panic("not implemented")
}