We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
SWC does not properly compile references to private names inside decorators
class A { #x = console.log.bind(console, "outer #x"); foo() { let after; @(new A().#x) class B { #x = console.log.bind(console, "inner #x"); @(after = () => new B().#x(this instanceof A), () => {}) f; } after(); } } new A().foo();
{ "jsc": { "parser": { "syntax": "typescript", "tsx": true, "decorators": true }, "target": "es2022", "loose": false, "minify": { "compress": false, "mangle": false } }, "module": { "type": "es6" }, "minify": false, "isModule": true }
https://play.swc.rs/?version=1.4.2&code=H4sIAAAAAAAAA4WPwQqDMBBEz%2FUrBr0kIP6AWKp%2FkqZJGwi70KRUEP%2B9cbXQW487Oztv1kaTEkYsFdDMGGCZEkfXRb5310A3dQgtan5l9yyuWvfF7ZmVljsgugzjy7avZL4ocm%2BMSnfNrEWxwpmK%2F7SN%2F1CB6Ae1RwqgnBXqcMYGmASg8iMkBErZkHXsMer2MC2rht8T1r2ZhChJXauifXvKN%2F0HgdSLUA4BAAA%3D&config=H4sIAAAAAAAAA1VPuw6DMAzc%2BQrkuUOVoUP%2FoR8RBYOCyEO2kYoQ%2F94EkrTd7LvznW%2Fv%2Bh5mNvDs9zSmJWpipLYnhDcv%2Bp0QkC0iG7JR4FZZ4UwJrdigAU0gLYG4MCdxXDyIpgkl2yGru1LFCpYQGBM86oWLFzjr7bj9PmOCi4TM%2F8Is1X5a2v2V2JVUcGFYT7KUzEWuDx7wFdWwZgyWX%2FXy7HF8AF26uLkwAQAA
No response
outer #x, class B {}, { kind: 'class', ... } inner #x true
Uncaught: TypeError: Cannot read private member #x from an object whose class did not declare it
class A { #x = console.log.bind(console, "outer #x"); foo() { let after; class B { #x = console.log.bind(console, "inner #x"); f; } _ts_decorate([ (after = ()=>new B().#x(this instanceof A), ()=>{}) ], B.prototype, "f", void 0); B = _ts_decorate([ new A().#x ], B); after(); } } new A().foo();
1.4.2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
SWC does not properly compile references to private names inside decorators
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.4.2&code=H4sIAAAAAAAAA4WPwQqDMBBEz%2FUrBr0kIP6AWKp%2FkqZJGwi70KRUEP%2B9cbXQW487Oztv1kaTEkYsFdDMGGCZEkfXRb5310A3dQgtan5l9yyuWvfF7ZmVljsgugzjy7avZL4ocm%2BMSnfNrEWxwpmK%2F7SN%2F1CB6Ae1RwqgnBXqcMYGmASg8iMkBErZkHXsMer2MC2rht8T1r2ZhChJXauifXvKN%2F0HgdSLUA4BAAA%3D&config=H4sIAAAAAAAAA1VPuw6DMAzc%2BQrkuUOVoUP%2FoR8RBYOCyEO2kYoQ%2F94EkrTd7LvznW%2Fv%2Bh5mNvDs9zSmJWpipLYnhDcv%2Bp0QkC0iG7JR4FZZ4UwJrdigAU0gLYG4MCdxXDyIpgkl2yGru1LFCpYQGBM86oWLFzjr7bj9PmOCi4TM%2F8Is1X5a2v2V2JVUcGFYT7KUzEWuDx7wFdWwZgyWX%2FXy7HF8AF26uLkwAQAA
SWC Info output
No response
Expected behavior
Actual behavior
Version
1.4.2
Additional context
No response
The text was updated successfully, but these errors were encountered: