Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embind: Remove str-to-func eval of named function factory #18748

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 14, 2023

@sbc100 sbc100 force-pushed the embind_computed_property_name branch from 8a702c5 to 4913805 Compare February 14, 2023 19:57
@sbc100 sbc100 changed the title Remove str-to-func eval of named function factory embind: Remove str-to-func eval of named function factory Feb 14, 2023
@sbc100 sbc100 enabled auto-merge (squash) February 14, 2023 19:59
src/embind/embind.js Outdated Show resolved Hide resolved
src/embind/embind.js Outdated Show resolved Hide resolved
For support for this feature see:
ttps://caniuse.com/mdn-javascript_operators_object_initializer_computed_property_names

Based on #17296
@sbc100 sbc100 force-pushed the embind_computed_property_name branch from 4913805 to 8094e17 Compare February 14, 2023 23:49
@sbc100 sbc100 requested a review from kripken February 14, 2023 23:50
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@sbc100 sbc100 merged commit df72746 into main Feb 15, 2023
@sbc100 sbc100 deleted the embind_computed_property_name branch February 15, 2023 17:07
RReverser added a commit to RReverser/emscripten that referenced this pull request Oct 18, 2023
Further simplification of createNamedFunction on top of emscripten-core#18748: we can avoid extra JS wrapper by setting `name` of the function directly.

This is only supported via "configuring" it by `Object.defineProperty` rather than plain assignment, but otherwise has exactly same effect - it sets debug name of the function in-place.

Also, ever since emscripten-core#18748 switched away from `eval`, there is no requirement for the function name to be "legal" - we can set it to the plain demangled string, making debug names even more readable.
RReverser added a commit that referenced this pull request Oct 18, 2023
Further simplification of createNamedFunction on top of #18748: we can avoid extra JS wrapper by setting `name` of the function directly.

This is only supported via "configuring" it by `Object.defineProperty` rather than plain assignment, but otherwise has exactly same effect - it sets debug name of the function in-place.

Also, ever since #18748 switched away from `eval`, there is no requirement for the function name to be "legal" - we can set it to the plain demangled string, making debug names even more readable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants