Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the SimplePass class to support an optional data parameter in both the _apply_impl and transformJoinpoint methods. This enables passes to receive additional contextual data when performing transformations on joinpoints.
Changes:
- Fixed a typo in the documentation comment ("tranformation" → "transformation")
- Added optional
data?: anyparameter to_apply_implmethod - Added optional
data?: anyparameter to abstracttransformJoinpointmethod - Updated the method call to pass
datatotransformJoinpointwithin_apply_impl
| * @returns Results of applying this pass to the given joinpoint | ||
| */ | ||
| _apply_impl($jp: LaraJoinPoint): AggregatePassResult { | ||
| _apply_impl($jp: LaraJoinPoint, data?: any): AggregatePassResult { |
There was a problem hiding this comment.
The base class Pass defines _apply_impl as _apply_impl($jp: LaraJoinPoint): PassResult, which does not include the optional data parameter. This creates a signature mismatch where SimplePass._apply_impl has an additional optional parameter that the base class does not support. Since Pass.apply() (line 33 in Pass.ts) calls this._apply_impl($actualJp) with only one argument, the data parameter will never be passed through the normal flow. Consider also updating the base class Pass to support the optional data parameter, or provide an alternative method to pass data to the transformation.
| * @returns The result of the transformation | ||
| */ | ||
| abstract transformJoinpoint($jp: LaraJoinPoint): PassResult | never; | ||
| abstract transformJoinpoint($jp: LaraJoinPoint, data?: any): PassResult | never; |
There was a problem hiding this comment.
The AdapterPass class, which extends SimplePass, needs to be updated to match the new signature. The transformJoinpoint method in AdapterPass.ts (line 66-69) only accepts $jp parameter, but the abstract method now requires an optional data parameter. This will cause a TypeScript compilation error or type mismatch.
Refactor
SimplePassclass to support an optionaldataparameter in methods_apply_implandtransformJoinpoint.