From 421f8111f0db271bd46fbfc5a38ec44874ff248c Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Sun, 4 Sep 2022 14:11:06 +0200 Subject: [PATCH] builtin_for now reports nice error message when given wrong arguments --- src/builtin_functions.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/builtin_functions.cc b/src/builtin_functions.cc index e1b8902..daea7c5 100644 --- a/src/builtin_functions.cc +++ b/src/builtin_functions.cc @@ -366,7 +366,15 @@ static Result builtin_for(Interpreter &i, std::vector args) return Value{}; } - unimplemented(); + return Error { + .details = errors::Unsupported_Types_For { + .type = errors::Unsupported_Types_For::Function, + .name = "for", + .possibilities = { + "(array, callback) -> nil", + }, + }, + }; } void Interpreter::register_builtin_functions()