-
Notifications
You must be signed in to change notification settings - Fork 246
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
feat(jsii): added warnings for usage of deprecated elements #3051
Conversation
…tion warnings and handling of types from other assemblies
The title of this Pull Request does not conform with [Conventional Commits] guidelines. It will need to be adjusted before the PR can be merged. |
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.
I think I'd prefer AssertionError
to be called something else (DeprecationError
seems logical?).
Other than that, I think we thought of most things that could become a problem. Let's make sure we try it out on an actual CDK build and poke at it (integration test), and then let's go ahead and merge!
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
Merging (with squash)... |
General idea:
First,
DeprecationWarningsInjector.process()
consumes the assembly. For each complex type in the assembly, it generates a function responsible for calling theprint
function if the type is deprecated. For each struct property or enum member, it also generates a call to the function corresponding to the type of that property or member. This creates a call tree that mirrors the type tree (including recursive functions that mirror recursive types).Then
Transformer
traverses the AST and for each parameter of a method, it injects into that method a call to the function corresponding to the type of that parameter.For example, for the types:
we get:
Then, if we have a method like:
the following calls will be injected into
doSomething
:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.