From d66ce4323987bf863a74c66e57c5128a28f1ada4 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Thu, 4 Mar 2021 13:14:24 +0300 Subject: [PATCH] compiler/interop: replace `int64` with `int` --- pkg/compiler/constant_test.go | 2 +- pkg/compiler/convert_test.go | 14 +++++++------- pkg/interop/convert/convert.go | 4 ++-- pkg/interop/runtime/runtime.go | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/compiler/constant_test.go b/pkg/compiler/constant_test.go index 42456659a..9b5c7976c 100644 --- a/pkg/compiler/constant_test.go +++ b/pkg/compiler/constant_test.go @@ -40,7 +40,7 @@ func TestByteConstant(t *testing.T) { src := `package foo import "github.com/nspcc-dev/neo-go/pkg/interop/convert" const a byte = 0xFF - func Main() int64 { + func Main() int { x := convert.ToInteger(a) return x+1 }` diff --git a/pkg/compiler/convert_test.go b/pkg/compiler/convert_test.go index 44e4a696b..c50e11d75 100644 --- a/pkg/compiler/convert_test.go +++ b/pkg/compiler/convert_test.go @@ -18,7 +18,7 @@ func getFunctionName(typ string) string { return "Bool" case "[]byte": return "ByteArray" - case "int64": + case "int": return "Integer" } panic("invalid type") @@ -40,12 +40,12 @@ func TestConvert(t *testing.T) { {"bool", "[]byte{0, 1, 0}", true}, {"bool", "[]byte{0}", true}, {"bool", `""`, false}, - {"int64", "true", big.NewInt(1)}, - {"int64", "false", big.NewInt(0)}, - {"int64", "12", big.NewInt(12)}, - {"int64", "0", big.NewInt(0)}, - {"int64", "[]byte{0, 1, 0}", big.NewInt(256)}, - {"int64", "[]byte{0}", big.NewInt(0)}, + {"int", "true", big.NewInt(1)}, + {"int", "false", big.NewInt(0)}, + {"int", "12", big.NewInt(12)}, + {"int", "0", big.NewInt(0)}, + {"int", "[]byte{0, 1, 0}", big.NewInt(256)}, + {"int", "[]byte{0}", big.NewInt(0)}, {"[]byte", "true", []byte{1}}, {"[]byte", "false", []byte{0}}, {"[]byte", "12", []byte{0x0C}}, diff --git a/pkg/interop/convert/convert.go b/pkg/interop/convert/convert.go index 060f14fbb..e4c606a81 100644 --- a/pkg/interop/convert/convert.go +++ b/pkg/interop/convert/convert.go @@ -2,8 +2,8 @@ package convert // ToInteger converts it's argument to an Integer. -func ToInteger(v interface{}) int64 { - return v.(int64) +func ToInteger(v interface{}) int { + return v.(int) } // ToByteArray converts it's argument to a ByteArray. diff --git a/pkg/interop/runtime/runtime.go b/pkg/interop/runtime/runtime.go index a8595317c..8a8b8cb16 100644 --- a/pkg/interop/runtime/runtime.go +++ b/pkg/interop/runtime/runtime.go @@ -62,8 +62,8 @@ func GetTrigger() byte { // GasLeft returns the amount of gas available for the current execution. // This function uses `System.Runtime.GasLeft` syscall. -func GasLeft() int64 { - return neogointernal.Syscall0("System.Runtime.GasLeft").(int64) +func GasLeft() int { + return neogointernal.Syscall0("System.Runtime.GasLeft").(int) } // GetNotifications returns notifications emitted by contract h.