mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 23:55:11 +00:00
Update compiler (#22)
* refactor to use ast.Walk for recursive converting * added lots of test cases * added a new way to handle jump labels * function calls with multiple arguments * binary expression (LOR LAND) * struct types + method receives * cleaner opcode dumps, side by side diff for debugging test cases
This commit is contained in:
parent
b257a06f3e
commit
8fe079ec8e
19 changed files with 1298 additions and 1064 deletions
26
pkg/vm/compiler/tests/array_test.go
Normal file
26
pkg/vm/compiler/tests/array_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package compiler_test
|
||||
|
||||
var arrayTestCases = []testCase{
|
||||
{
|
||||
"assign int array",
|
||||
`
|
||||
package foo
|
||||
func Main() []int {
|
||||
x := []int{1, 2, 3}
|
||||
return x
|
||||
}
|
||||
`,
|
||||
"52c56b53525153c16c766b00527ac46203006c766b00c3616c7566",
|
||||
},
|
||||
{
|
||||
"assign string array",
|
||||
`
|
||||
package foo
|
||||
func Main() []string {
|
||||
x := []string{"foo", "bar", "foobar"}
|
||||
return x
|
||||
}
|
||||
`,
|
||||
"52c56b06666f6f6261720362617203666f6f53c16c766b00527ac46203006c766b00c3616c7566",
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue