Compiler (#23)

* implemented add, mul, div, sub assign for identifiers.

* Implemented struct field initialization.

* Implemented imports

* Implemented storage VM API (interop layer) + additional bug fixes when encountered.

* Bumped version 0.12.0

* fixed double point extension on compiled output file.

* Fixed bug where callExpr in returns where added to voidCall

* fixed binExpr compare equal

* Check the env for the gopath first

* removed travis.yml

* custom types + implemented general declarations.

* commented out the storage test to make the build pass
This commit is contained in:
Anthony De Meulemeester 2018-02-24 10:06:48 +01:00 committed by GitHub
parent bebdabab9f
commit 23cfebf621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 798 additions and 117 deletions

View file

@ -1,4 +1,4 @@
package compiler_test
package compiler
var assignTestCases = []testCase{
{
@ -28,4 +28,88 @@ var assignTestCases = []testCase{
`,
"53c56b546c766b00527ac4586c766b00527ac46203006c766b00c3616c7566",
},
{
"add assign",
`
package foo
func Main() int {
x := 4
x += 8
return x
}
`,
"53c56b546c766b00527ac46c766b00c358936c766b00527ac46203006c766b00c3616c7566",
},
{
"sub assign",
`
package foo
func Main() int {
x := 4
x -= 2
return x
}
`,
"53c56b546c766b00527ac46c766b00c352946c766b00527ac46203006c766b00c3616c7566",
},
{
"mul assign",
`
package foo
func Main() int {
x := 4
x *= 2
return x
}
`,
"53c56b546c766b00527ac46c766b00c352956c766b00527ac46203006c766b00c3616c7566",
},
{
"div assign",
`
package foo
func Main() int {
x := 4
x /= 2
return x
}
`,
"53c56b546c766b00527ac46c766b00c352966c766b00527ac46203006c766b00c3616c7566",
},
{
"add assign binary expr",
`
package foo
func Main() int {
x := 4
x += 6 + 2
return x
}
`,
"53c56b546c766b00527ac46c766b00c358936c766b00527ac46203006c766b00c3616c7566",
},
{
"add assign binary expr ident",
`
package foo
func Main() int {
x := 4
y := 5
x += 6 + y
return x
}
`,
"54c56b546c766b00527ac4556c766b51527ac46c766b00c3566c766b51c393936c766b00527ac46203006c766b00c3616c7566",
},
{
"decl assign",
`
package foo
func Main() int {
var x int = 4
return x
}
`,
"52c56b546c766b00527ac46203006c766b00c3616c7566",
},
}