about summary refs log tree commit diff
path: root/pkg/lang/vm
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm')
-rw-r--r--pkg/lang/vm/errors.go6
-rw-r--r--pkg/lang/vm/exec.go2
-rw-r--r--pkg/lang/vm/vm_test.go14
3 files changed, 11 insertions, 11 deletions
diff --git a/pkg/lang/vm/errors.go b/pkg/lang/vm/errors.go
index 640ab21..4781179 100644
--- a/pkg/lang/vm/errors.go
+++ b/pkg/lang/vm/errors.go
@@ -92,11 +92,11 @@ func (e ErrArrayIndexOutOfBounds) Error() string {
 	return fmt.Sprintf("array index out of bounds: %d (len: %d)", e.Index, e.Len)
 }
 
-type ErrNotEnoughArguments struct {
+type ErrWrongNumberOfArguments struct {
 	Needed uint
 	Got    uint
 }
 
-func (e ErrNotEnoughArguments) Error() string {
-	return fmt.Sprintf("not enough arguments: needed %d, got %d", e.Needed, e.Got)
+func (e ErrWrongNumberOfArguments) Error() string {
+	return fmt.Sprintf("wrong number of arguments: needed %d, got %d", e.Needed, e.Got)
 }
diff --git a/pkg/lang/vm/exec.go b/pkg/lang/vm/exec.go
index d4426e1..c8b4fb3 100644
--- a/pkg/lang/vm/exec.go
+++ b/pkg/lang/vm/exec.go
@@ -593,7 +593,7 @@ func (vm *VM) execCall(argCount uint) error {
 	fn := f.Data().(value.FunctionData)
 
 	if argCount != fn.Args() {
-		return ErrNotEnoughArguments{
+		return ErrWrongNumberOfArguments{
 			Got:    argCount,
 			Needed: fn.Args(),
 		}
diff --git a/pkg/lang/vm/vm_test.go b/pkg/lang/vm/vm_test.go
index 287e7a8..c0b5c2e 100644
--- a/pkg/lang/vm/vm_test.go
+++ b/pkg/lang/vm/vm_test.go
@@ -96,7 +96,7 @@ func TestFunction(t *testing.T) {
 	src := `
 	push_int 44
 	push_function @subtract_two
-	call
+	call 1
 	halt
 
 	@subtract_two:
@@ -119,7 +119,7 @@ func TestSimpleEnv(t *testing.T) {
     push_function @test
     # Add the local 1 to the environment.
     add_to_env 1
-    call
+    call 0
     halt
 
     @test:
@@ -148,22 +148,22 @@ func TestEscapedEnv(t *testing.T) {
 
 	src := `    
     push_function @create
-    call
+    call 0
 
     push_array
 
     get_local 0
-    call
+    call 0
     get_local 1
     temp_arr_push
 
     get_local 0
-    call
+    call 0
     get_local 1
     temp_arr_push
     
     get_local 0
-    call
+    call 0
     get_local 1
     temp_arr_push
     halt
@@ -204,7 +204,7 @@ func TestMember(t *testing.T) {
 	temp_arr_push
 
 	get_member "length"
-	call
+	call 0
 	`
 
 	test(t, src, "3")