diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fc58bc8a..7302a0a9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,6 @@ on: - '!examples/**' - '.github/workflows/ci.yml' push: - branches: - - master paths: - '**' - '!.gitignore' diff --git a/quickjs.c b/quickjs.c index eff3ae05d..624a56334 100644 --- a/quickjs.c +++ b/quickjs.c @@ -8882,6 +8882,21 @@ static int JS_SetPropertyInternal2(JSContext *ctx, JSValue obj, JSAtom prop, pr = add_property(ctx, p, prop, JS_PROP_C_W_E); if (!pr) goto fail; + + // try give function name in every possible way + if (JS_IsFunction(ctx, val)) { + JSObject *vf = JS_VALUE_GET_OBJ(val); + if (vf->class_id == JS_CLASS_BYTECODE_FUNCTION) { + const char *name = get_func_name(ctx, val); + if(name && *name == '\0') { + JSValue js_value = JS_AtomToValue(ctx, prop); + JS_DefinePropertyValue(ctx, val, JS_ATOM_name, js_value, JS_PROP_CONFIGURABLE); + + JS_FreeCString(ctx, name); + } + } + } + pr->u.value = val; return true; }