Commit 05745ab4 authored by Philip Chimento's avatar Philip Chimento 🚮

Merge branch 'verdre/gjs-small-invoke-c-func-improvement'

See merge request !454
parents 5923bc8d de24d1bb
Pipeline #192735 failed with stages
in 15 minutes and 53 seconds
......@@ -834,14 +834,18 @@ static bool gjs_invoke_c_function(JSContext* context, Function* function,
*
* @args.length() is the number of arguments that were actually passed.
*/
GjsAutoChar name = format_function_name(function);
if (args.length() > function->expected_js_argc) {
GjsAutoChar name = format_function_name(function);
if (!JS::WarnUTF8(
context, "Too many arguments to %s: expected %d, got %u",
name.get(), function->expected_js_argc, args.length()))
return false;
} else if (!args.requireAtLeast(context, name,
function->expected_js_argc)) {
} else if (args.length() < function->expected_js_argc) {
GjsAutoChar name = format_function_name(function);
args.reportMoreArgsNeeded(context, name, function->expected_js_argc,
args.length());
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment