Name remapping support for lambda functions #126
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm trying to find a way to get original function names for lambda functions, which currently looks like it's not supported, or I'm not finding the right way to make it work.
In order to explain this, I created this simple test that is based on this simple source code:
And used uglifyjs to generate the minified version and sourcemap:
uglifyjs source.js --compress --mangle --output source.min.js --source-map includeSources
The problem is when trying to get the original function name for
(0, 106, "n", "aLambdaAsConst"),
.The reason I think why this doesn't work is because here
rust-sourcemap/src/sourceview.rs
Lines 300 to 304 in 3f32cae
we just check for
function
preceding the token name.. I wonder if const should be included, but I think it's going to cause some false positives.. Any ideas? Am I doing something wrong here?I found it interesting that I saw some cases in sentry where the actual function name gets correctly translated in these cases, so maybe I'm just missing something here. e.g. here

renderPath
is picked up from a lambda const: