forked from TrueCloudLab/neoneo-go
compiler/interop: replace int64
with int
This commit is contained in:
parent
1138143a50
commit
d66ce43239
4 changed files with 12 additions and 12 deletions
|
@ -40,7 +40,7 @@ func TestByteConstant(t *testing.T) {
|
||||||
src := `package foo
|
src := `package foo
|
||||||
import "github.com/nspcc-dev/neo-go/pkg/interop/convert"
|
import "github.com/nspcc-dev/neo-go/pkg/interop/convert"
|
||||||
const a byte = 0xFF
|
const a byte = 0xFF
|
||||||
func Main() int64 {
|
func Main() int {
|
||||||
x := convert.ToInteger(a)
|
x := convert.ToInteger(a)
|
||||||
return x+1
|
return x+1
|
||||||
}`
|
}`
|
||||||
|
|
|
@ -18,7 +18,7 @@ func getFunctionName(typ string) string {
|
||||||
return "Bool"
|
return "Bool"
|
||||||
case "[]byte":
|
case "[]byte":
|
||||||
return "ByteArray"
|
return "ByteArray"
|
||||||
case "int64":
|
case "int":
|
||||||
return "Integer"
|
return "Integer"
|
||||||
}
|
}
|
||||||
panic("invalid type")
|
panic("invalid type")
|
||||||
|
@ -40,12 +40,12 @@ func TestConvert(t *testing.T) {
|
||||||
{"bool", "[]byte{0, 1, 0}", true},
|
{"bool", "[]byte{0, 1, 0}", true},
|
||||||
{"bool", "[]byte{0}", true},
|
{"bool", "[]byte{0}", true},
|
||||||
{"bool", `""`, false},
|
{"bool", `""`, false},
|
||||||
{"int64", "true", big.NewInt(1)},
|
{"int", "true", big.NewInt(1)},
|
||||||
{"int64", "false", big.NewInt(0)},
|
{"int", "false", big.NewInt(0)},
|
||||||
{"int64", "12", big.NewInt(12)},
|
{"int", "12", big.NewInt(12)},
|
||||||
{"int64", "0", big.NewInt(0)},
|
{"int", "0", big.NewInt(0)},
|
||||||
{"int64", "[]byte{0, 1, 0}", big.NewInt(256)},
|
{"int", "[]byte{0, 1, 0}", big.NewInt(256)},
|
||||||
{"int64", "[]byte{0}", big.NewInt(0)},
|
{"int", "[]byte{0}", big.NewInt(0)},
|
||||||
{"[]byte", "true", []byte{1}},
|
{"[]byte", "true", []byte{1}},
|
||||||
{"[]byte", "false", []byte{0}},
|
{"[]byte", "false", []byte{0}},
|
||||||
{"[]byte", "12", []byte{0x0C}},
|
{"[]byte", "12", []byte{0x0C}},
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
package convert
|
package convert
|
||||||
|
|
||||||
// ToInteger converts it's argument to an Integer.
|
// ToInteger converts it's argument to an Integer.
|
||||||
func ToInteger(v interface{}) int64 {
|
func ToInteger(v interface{}) int {
|
||||||
return v.(int64)
|
return v.(int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToByteArray converts it's argument to a ByteArray.
|
// ToByteArray converts it's argument to a ByteArray.
|
||||||
|
|
|
@ -62,8 +62,8 @@ func GetTrigger() byte {
|
||||||
|
|
||||||
// GasLeft returns the amount of gas available for the current execution.
|
// GasLeft returns the amount of gas available for the current execution.
|
||||||
// This function uses `System.Runtime.GasLeft` syscall.
|
// This function uses `System.Runtime.GasLeft` syscall.
|
||||||
func GasLeft() int64 {
|
func GasLeft() int {
|
||||||
return neogointernal.Syscall0("System.Runtime.GasLeft").(int64)
|
return neogointernal.Syscall0("System.Runtime.GasLeft").(int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNotifications returns notifications emitted by contract h.
|
// GetNotifications returns notifications emitted by contract h.
|
||||||
|
|
Loading…
Reference in a new issue