| 1233 | } |
| 1234 | |
| 1235 | bool Function::to_string_impl(JSContext* cx, JS::MutableHandleValue rval) { |
| 1236 | int n_args = m_info.n_args(); |
| 1237 | std::string arg_names; |
| 1238 | for (int i = 0, n_jsargs = 0; i < n_args; i++) { |
| 1239 | Argument* gjs_arg = m_arguments.argument(i); |
| 1240 | if (!gjs_arg || gjs_arg->skip_in()) |
| 1241 | continue; |
| 1242 | |
| 1243 | if (n_jsargs > 0) |
| 1244 | arg_names += ", "; |
| 1245 | |
| 1246 | n_jsargs++; |
| 1247 | arg_names += gjs_arg->arg_name(); |
| 1248 | } |
| 1249 | |
| 1250 | AutoChar descr; |
| 1251 | if (auto func_info = m_info.as<GI::InfoTag::FUNCTION>()) { |
| 1252 | descr = g_strdup_printf( |
| 1253 | "%s(%s) {\n\t/* wrapper for native symbol %s() */\n}", |
| 1254 | format_name().c_str(), arg_names.c_str(), func_info->symbol()); |
| 1255 | } else { |
| 1256 | descr = |
| 1257 | g_strdup_printf("%s(%s) {\n\t/* wrapper for native symbol */\n}", |
| 1258 | format_name().c_str(), arg_names.c_str()); |
| 1259 | } |
| 1260 | |
| 1261 | return gjs_string_from_utf8(cx, descr, rval); |
| 1262 | } |
| 1263 | |
| 1264 | const JSClassOps Function::class_ops = { |
| 1265 | nullptr, // addProperty |