summaryrefslogtreecommitdiff
path: root/codegen/compiler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/compiler_test.go')
-rw-r--r--codegen/compiler_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/codegen/compiler_test.go b/codegen/compiler_test.go
index 5989210..a876d52 100644
--- a/codegen/compiler_test.go
+++ b/codegen/compiler_test.go
@@ -16,7 +16,7 @@ func TestCodeGen(t *testing.T) {
test := test
t.Run("", func(t *testing.T) {
c := NewCompiler()
- c.AddSym(fmt.Println, "println", false)
+ c.AddSym(fmt.Println, "println")
n := &parser.Node{}
var err error
if n.Child, err = golang.GoParser.Parse(test.src); err != nil {
@@ -45,13 +45,13 @@ var tests = []struct {
asm: "Push 1\nPush 2\nAdd\n",
}, { // #01
src: `println("Hello")`,
- asm: "Dup 0\nDup 1\nCallX 1\n",
+ asm: "Dup 0\nDup 1\nCallX 1\nPop 2\n",
}, { // #02
src: `a := 2; println(a)`,
- asm: "Push 2\nAssign 1\nDup 0\nDup 1\nCallX 1\n",
+ asm: "Push 2\nAssign 1\nDup 0\nDup 1\nCallX 1\nPop 2\n",
}, { // #03
src: `a := 2; if a < 3 {println(a)}; println("bye")`,
- asm: "Push 2\nAssign 1\nDup 1\nPush 3\nLower\nJumpFalse 4\nDup 0\nDup 1\nCallX 1\nDup 0\nDup 2\nCallX 1\n",
+ asm: "Push 2\nAssign 1\nDup 1\nPush 3\nLower\nJumpFalse 5\nDup 0\nDup 1\nCallX 1\nPop 2\nDup 0\nDup 2\nCallX 1\nPop 2\n",
}, { // #04
src: "func add(a int, b int) int { return a + b }",
asm: "Fdup -2\nFdup -3\nAdd\nReturn 1 2\n",