@@ -332,6 +332,19 @@ and map_to_list_builtin (args, state) _ss _loc =
332332 ValList ls, state
333333 | _ -> assert false
334334
335+ and typeof_builtin (args , state ) _ss _loc =
336+ match args with
337+ | Tuple [Number _] -> Atom 2 , state
338+ | Tuple [Integer _] -> Atom 3 , state
339+ | Tuple [Boolean _] -> Atom 4 , state
340+ | Tuple [Tuple _] -> Atom 5 , state
341+ | Tuple [ValList _] -> Atom 6 , state
342+ | Tuple [(Lambda _) | (LambdaCapture _ ) | (Fn _ )] -> Atom 7 , state
343+ | Tuple [Dictionary _] -> Atom 8 , state
344+ | Tuple [Atom _] -> Atom 9 , state
345+ | Tuple [StringVal _] -> Atom 10 , state
346+ | _ -> assert false
347+
335348and eval_pipe ~tc lhs rhs ss loc = fun s ->
336349 let (lhs, s) = (eval_expr lhs ss) s in
337350 let (rhs, s) = (eval_expr rhs ss) s in
@@ -525,6 +538,7 @@ and eval_lambda_call ?tc:(tail_call=false) call ss loc =
525538 | ResolvedIdent 13 -> list_dir_builtin ((eval_expr call.call_args ss) state) ss loc
526539 | ResolvedIdent 14 -> map_keys_builtin ((eval_expr call.call_args ss) state) ss loc
527540 | ResolvedIdent 15 -> map_to_list_builtin ((eval_expr call.call_args ss) state) ss loc
541+ | ResolvedIdent 16 -> typeof_builtin ((eval_expr call.call_args ss) state) ss loc
528542 | UnresolvedIdent s ->
529543 printf " Error: unresolved function %s not found at %s\n " s (location_to_string loc);
530544 print_traceback ss;
0 commit comments