Provide instance reference for constructor calls. #528
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.
Description
instance
parameter in theIMethodDecorator.Init
method is currentlynull
for constructor calls.As described in #71 , it can be useful to have a reference to the instance.
The solution
The PR provides the instance reference for constructors. Now the only time the reference is not provided is for static members.
One caveat with this is that the object is only fully initialized after the constructor has finished, so providing the reference could cause issues if it's used for operations that require a fully initialized object.
Maybe this should be configurable by the user and disabled by default?
Todos