@@ -8893,22 +8893,14 @@ static int JS_SetPropertyInternal2(JSContext *ctx, JSValue obj, JSAtom prop,
88938893 JSObject *vf = JS_VALUE_GET_OBJ(val);
88948894 if (vf->class_id == JS_CLASS_BYTECODE_FUNCTION &&
88958895 vf->u.func.var_refs == NULL) {
8896- JSValue name_val = JS_GetProperty(ctx, val, JS_ATOM_name);
8897-
8898- if (JS_IsString(name_val)) {
8899- const char *name = JS_ToCString(ctx, name_val);
8900- if (name != NULL) {
8901- if (strcmp(name, "") == 0) {
8902- JSValue js_value = JS_AtomToValue(ctx, prop);
8903- JS_DefinePropertyValue(ctx, val, JS_ATOM_name, js_value, JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE);
8904- JS_FreeValue(ctx, js_value);
8905- }
8906-
8907- JS_FreeCString(ctx, name);
8908- }
8909-
8896+ const char* name = get_func_name(ctx, val);
8897+ if (strcmp(name, "") == 0) {
8898+ JSValue js_value = JS_AtomToValue(ctx, prop);
8899+ JS_DefinePropertyValue(ctx, val, JS_ATOM_name, js_value, JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE);
8900+ JS_FreeValue(ctx, js_value);
89108901 }
8911- JS_FreeValue(ctx, name_val);
8902+
8903+ JS_FreeCString(ctx, name);
89128904 }
89138905 }
89148906
0 commit comments