facebook / hermes

A JavaScript engine optimized for running React Native.
https://hermesengine.dev/
MIT License
9.41k stars 596 forks source link

[Debugger] Modify ES6 Method names instead of removing them #1363

Closed Beanyy closed 1 month ago

Beanyy commented 1 month ago

Summary

The method names of ES6 classes were being stripped out to prevent name conflicts when there's both a function and method with identical names. However, when connecting the Debugger or Profiler, this causes all class methods to show up with the name anonymous instead of its actual function name.

This change modifies the ES6 method names to prefix and suffix them with '#' instead of removing it, so that the debugger and profiler give more detailed information, while still preventing the name conflicts.

Before: Screenshot 2024-03-28 at 2 46 57 PM

After: Screenshot 2024-03-28 at 2 42 36 PM

Test Plan

tmikov commented 1 month ago

Makes sense

facebook-github-bot commented 1 month ago

@tmikov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 month ago

@tmikov merged this pull request in facebook/hermes@acb4596a324960f16a7efba73c3be876fbae6584.