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:
Anthony De Meulemeester 2018-02-19 10:24:28 +01:00 committed by GitHub
parent b257a06f3e
commit 8fe079ec8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1298 additions and 1064 deletions

View 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",
},
}