Skip to content

Commit

Permalink
add native handler
Browse files Browse the repository at this point in the history
  • Loading branch information
liz3 committed Nov 14, 2024
1 parent 5415b63 commit 9d73540
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,10 @@ DictuInterpretResult dictuInterpret(DictuVM *vm, char *moduleName, char *source)
Value callFunction(DictuVM* vm, Value function, int argCount, Value* args) {

if(!IS_FUNCTION(function) && !IS_CLOSURE(function)){
if(IS_NATIVE(function)) {
NativeFn native = AS_NATIVE(function);
return native(vm, argCount, args);
}
runtimeError(vm, "Value passed to callFunction is not callable");
return EMPTY_VAL;
}
Expand Down

0 comments on commit 9d73540

Please sign in to comment.