compiler,interop: make AppCall accept varargs

This commit is contained in:
Evgenii Stratonikov 2020-02-10 10:51:29 +03:00
parent 1fc64d515f
commit 52d8d58593
2 changed files with 4 additions and 6 deletions

View file

@ -55,9 +55,7 @@ func TestFromAddress(t *testing.T) {
func TestAppCall(t *testing.T) {
srcInner := `
package foo
func Main(args []interface{}) int {
a := args[0].(int)
b := args[1].(int)
func Main(a int, b int) int {
return a + b
}
`
@ -109,7 +107,7 @@ func TestAppCall(t *testing.T) {
func Main() int {
x := 13
y := 29
result := engine.AppCall([]byte(scriptHash), []interface{}{x, y})
result := engine.AppCall([]byte(scriptHash), x, y)
return result.(int)
}
`
@ -130,7 +128,7 @@ func getAppCallScript(h string) string {
func Main() int {
x := 13
y := 29
result := engine.AppCall(` + h + `, []interface{}{x, y})
result := engine.AppCall(` + h + `, x, y)
return result.(int)
}
`

View file

@ -29,6 +29,6 @@ func GetEntryScriptHash() []byte {
}
// AppCall executes script with specified hash using provided arguments.
func AppCall(scriptHash []byte, args []interface{}) interface{} {
func AppCall(scriptHash []byte, args ...interface{}) interface{} {
return nil
}