-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Ensure class decorators can access decorated non-static members #15332
Conversation
get c() { | ||
return applyClassDecs(targetClass, classDecs); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class decorators are applied after member decorators are applied and bound to the initializer locals, such as initA
, initProto
, etc.
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53767/ |
The CI failure looks related. |
Yes. CI is failing for the same reason of #14836 (comment). I will investigate how I can resolve it without renaming functions. |
Helper diff: https://www.diffchecker.com/wMz5rhsx/ |
The e2e build was failing because we simply concat all helper codes in babel/packages/babel-core/src/tools/build-external-helpers.ts Lines 172 to 181 in 6e03af1
which forms the content of the virtual A proper fix would be to handle function name collisions in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JLHwung The Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was:
error has been removed from the new helper: is it now supported, or was that error just unreachable?
This PR slightly increases the output size:
It's fine, decorators are already considered heavy and this is just a few more bytes.
That part is not changed: 5dbfd3d#diff-1055897236adecf62778dc76b5b6168bc5c14344106b32a8a14c78479f601cb2R397 The only revisions are that |
…-03.ts Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
applyDecs2203R
based onapplyDecs2203
, which lazily apply class decorations so that the class decorate will have access to the decorated non-static class elements. Because the return type is changed, we have to create a new runtime. In Babel 8 we can remove deprecated helpersapplyDecs2203
andapplyDecs
This PR slightly increases the output size:
We could preserve the output size if
applyDecs2203R
can return a customized iterator, i.e.but then our runtime helper will not be ES5-compliant. We can revisit this approach if we bump helper targets in the future.