fix: add support for classes with decorators #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When using decorators with Babel, Babel creates a sequence wrapper in order to apply the decorators, something like this:
And when this plugin tries to add the
inject
property, it ends up between the class expression and_temp2
, making the code invalid and breaking the execution.The solution I implemented here is that, when working with a class, if the class is inside a sequence expression, the plugin will crawl all the way up until the top path is the program itself, and then add the definition:
})), _class); + Hello.inject = ['something'];
How should it be tested manually?