-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
self reference in static block is not working well on rename #4811
Comments
@lukastaegert I'm wondering if this is a right way to solve this problem, using the class name instead of let Test$1 = class Test {
static test = 'Test1';
static { console.log(Test.test); }
}; |
Yes, I think that should work. |
I realized that keeping name on static block is maybe not enough, it should probably be kept on non-static block also. For example would give this as a result if the fix is done only on static block (so an error would be raised): let Test$1 = class Test {
constructor() {
console.log(Test$1.test);
}
static test = 'Test1';
static {
console.log(Test.test);
new Test();
}
}; The name should probably be also be kept everywhere inside the class: let Test$1 = class Test {
constructor() {
console.log(Test.test);
}
static test = 'Test1';
static {
console.log(Test.test);
new Test();
}
}; I am not sure that the PR is taking this into account. |
Oh, thanks! I didn't take this into account, I'll fix it later in the PR. |
This issue has been resolved via #4827 as part of rollup@3.12.1. You can test it via |
Rollup Version
3.10.0
Operating System (or Browser)
Chrome
Node Version (if applicable)
No response
Link To Reproduction
https://rollupjs.org/repl/?version=3.10.0&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMiUyRiolMjBUUkVFLVNIQUtJTkclMjAqJTJGJTVDbmltcG9ydCUyMCU3QiUyMFRlc3QlMjAlN0QlMjBmcm9tJTIwJy4lMkZ0ZXN0MS5qcyclM0IlNUNuaW1wb3J0JTIwJTdCJTIwVGVzdCUyMGFzJTIwVGVzdDIlMjAlN0QlMjBmcm9tJTIwJy4lMkZ0ZXN0Mi5qcyclM0IlNUNuY29uc29sZS5sb2coVGVzdC50ZXN0JTJDJTIwVGVzdDIudGVzdCklMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJ0ZXN0MS5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjIlNUNuZXhwb3J0JTIwY2xhc3MlMjBUZXN0JTIwJTdCJTVDbiUyMCUyMHN0YXRpYyUyMHRlc3QlMjAlM0QlMjAnVGVzdDEnJTNCJTVDbiUyMCUyMHN0YXRpYyUyMCU3QiUyMGNvbnNvbGUubG9nKFRlc3QudGVzdCklM0IlMjAlN0QlNUNuJTdEJTIyJTJDJTIyaXNFbnRyeSUyMiUzQWZhbHNlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMnRlc3QyLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMiU1Q25leHBvcnQlMjBjbGFzcyUyMFRlc3QlMjAlN0IlNUNuJTIwJTIwc3RhdGljJTIwdGVzdCUyMCUzRCUyMCdUZXN0MiclM0IlNUNuJTIwJTIwc3RhdGljJTIwJTdCJTIwY29uc29sZS5sb2coVGVzdC50ZXN0KSUzQiUyMCU3RCU1Q24lN0QlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXMlMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==
Expected Behaviour
When running, it should give the following in console.
Actual Behaviour
Currently it give an error:
The text was updated successfully, but these errors were encountered: