diff options
| author | Mel <einebeere@gmail.com> | 2022-07-26 02:37:38 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-07-26 02:37:38 +0200 |
| commit | 41490ae52e3b1ff20980c5e0837d257043b3ca92 (patch) | |
| tree | 9d2574dbcdc6f82a9b89cfcf64f7e25634484a5a /pkg/lang/compiler/compiler_test.go | |
| parent | b6fa4bc82398b09307f2e6b75e27422d1d1ecb33 (diff) | |
| download | jinx-41490ae52e3b1ff20980c5e0837d257043b3ca92.tar.zst jinx-41490ae52e3b1ff20980c5e0837d257043b3ca92.zip | |
Store functions in locals and remove hoisting
Diffstat (limited to 'pkg/lang/compiler/compiler_test.go')
| -rw-r--r-- | pkg/lang/compiler/compiler_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/lang/compiler/compiler_test.go b/pkg/lang/compiler/compiler_test.go index b8a6264..07586a6 100644 --- a/pkg/lang/compiler/compiler_test.go +++ b/pkg/lang/compiler/compiler_test.go @@ -434,15 +434,17 @@ func TestForIn(t *testing.T) { func TestSimpleFunction(t *testing.T) { src := ` - var result = the_meaning_of_life() - fn the_meaning_of_life() { return 42 } + + var result = the_meaning_of_life() ` expected := ` push_function @the_meaning_of_life + + get_local 0 call 0 halt @@ -466,6 +468,8 @@ func TestFunctionArgs(t *testing.T) { expected := ` push_function @add set_arg_count 2 + + get_local 0 push_int 4 push_int 5 call 2 |
