compiler/interop: replace int64 with int

This commit is contained in:
Evgeniy Stratonikov 2021-03-04 13:14:24 +03:00
parent 1138143a50
commit d66ce43239
4 changed files with 12 additions and 12 deletions

View file

@ -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
}`

View file

@ -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}},

View file

@ -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.

View file

@ -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.