compiler: add support for static-variables in debug info

This commit is contained in:
Evgeniy Stratonikov 2021-05-12 14:54:40 +03:00
parent e8ba386e58
commit 7afca7f8e5
3 changed files with 21 additions and 5 deletions

View file

@ -17,6 +17,7 @@ func TestCodeGen_DebugInfo(t *testing.T) {
import "github.com/nspcc-dev/neo-go/pkg/interop"
import "github.com/nspcc-dev/neo-go/pkg/interop/storage"
import "github.com/nspcc-dev/neo-go/pkg/interop/native/ledger"
var staticVar int
func Main(op string) bool {
var s string
_ = s
@ -79,6 +80,7 @@ func _deploy(data interface{}, isUpdate bool) {}
"MethodOnPointerToStruct": "Void",
"MethodParams": "Boolean",
"_deploy": "Void",
manifest.MethodInit: "Void",
}
for i := range d.Methods {
name := d.Methods[i].ID
@ -98,6 +100,10 @@ func _deploy(data interface{}, isUpdate bool) {}
}
})
t.Run("static variables", func(t *testing.T) {
require.Equal(t, []string{"staticVar,Integer"}, d.StaticVariables)
})
t.Run("param types", func(t *testing.T) {
paramTypes := map[string][]DebugParam{
"_deploy": {
@ -162,6 +168,11 @@ func _deploy(data interface{}, isUpdate bool) {}
Name: "MyCTR",
ABI: manifest.ABI{
Methods: []manifest.Method{
{
Name: manifest.MethodInit,
Parameters: []manifest.Parameter{},
ReturnType: smartcontract.VoidType,
},
{
Name: "_deploy",
Parameters: []manifest.Parameter{