builtin_for now reports nice error message when given wrong arguments

This commit is contained in:
Robert Bendun 2022-09-04 14:11:06 +02:00
parent aabcc42625
commit 421f8111f0

View File

@ -366,7 +366,15 @@ static Result<Value> builtin_for(Interpreter &i, std::vector<Value> 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()