Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ on:
- '!examples/**'
- '.github/workflows/ci.yml'
push:
branches:
- master
paths:
- '**'
- '!.gitignore'
Expand Down
18 changes: 18 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8882,6 +8882,24 @@ 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 != NULL) {
if (strcmp(name, "") == 0) {
JSValue js_value = JS_AtomToValue(ctx, prop);
JS_DefinePropertyValue(ctx, val, JS_ATOM_name, js_value, JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE);
JS_FreeValue(ctx, js_value);
}

JS_FreeCString(ctx, name);
}
}
}

pr->u.value = val;
return true;
}
Expand Down
Loading