-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Mangler inserts wrong function name on anonymous function declaration #6344
Comments
Seems like this only happens if you specify Also, es2015: |
I tried one more thing. I passed "use strict";
function a() { }
var te = function () {
var n = function n(e) { };
var t = null;
return {
init: function init(e) {
return t = new n(e);
}
};
}();
var he = function () {
var n = function n() {
a();
};
;
var t = null;
return {
init: function init(e) {
return t;
}
};
}(); to the name mangler, and it emitted "use strict";
function n() {}
var r = function() {
var n = function n(n) {};
var r = null;
return {
init: function t(t) {
return r = new n(t);
}
};
}();
var t = function() {
var r = function r() {
n();
};
var t = null;
return {
init: function n(n) {
return t;
}
};
}(); which is correct. So... I think the block scoping pass broken the rule of span hygiene |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
After the mangling, the second return value (return value of var
he
)'s logic becomes wrong.Input code
Config
Playground link
https://play.swc.rs/?version=1.3.12&code=H4sIAAAAAAAAA62OMQ6AIAxFd07REa4g8TDElEhCakJAB8PdhYrKYOJix9ff128TTdEtBEYq2LNYTYCIMIJti4oFlLkAkESOVsjxkqbkvWYSMKZA7aaOIxeHR4eq23UHbMGN7foOnF%2ByyLLA%2Bmz%2B6tbrjWyqrP9u%2B9rwALbE1g9NAQAA&config=H4sIAAAAAAAAA22OSwrDMAxE76J1Fu2iUHKHnqEIVw5O%2FRGSExqC714b8qHQlYZ5g3grjGqgX4FRlKQlXWLGD%2FRAJqAacZyhq7NaWfRKpYOMMlBuE71V5lNS2mgHwUVnl%2FbJpMBCqifCOHhqKCf2NJM%2F0JuIn8ajasRA%2BtvbPx2LmzFTvYlP5Oh%2BZEWL4q6X3btU85Be02awcL3NMaQ4KpTTfP%2Blj22dZaLyBbcl34krAQAA
Expected behavior
The
init
function in thehe
variable's logic should be same as before.return t
should reference variable insidehe
, not the function itself.Actual behavior
return t
reference the function itself.Version
1.3.12
Additional context
I think this result occurs in very tricky situation.
If you rename the function
init
to another or remove some lines, it works well :(The text was updated successfully, but these errors were encountered: