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