-
Notifications
You must be signed in to change notification settings - Fork 2
[Lara-JS] Refactor SimplePass class #82
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
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,20 +60,21 @@ export default abstract class SimplePass extends Pass { | |
| } | ||
|
|
||
| /** | ||
| * Apply tranformation to | ||
| * Apply tranformation to matching joinpoints | ||
| * | ||
| * @param $jp - Joinpoint on which the pass will be applied | ||
| * @param data - Optional data that may be needed to perform the transformation | ||
| * @returns Results of applying this pass to the given joinpoint | ||
| */ | ||
| _apply_impl($jp: LaraJoinPoint): AggregatePassResult { | ||
| _apply_impl($jp: LaraJoinPoint, data?: any): AggregatePassResult { | ||
| const matchingJps = this._selectedJps($jp).filter(($jp) => | ||
| this.matchJoinpoint($jp) | ||
| ); | ||
|
|
||
| const aggResult = new AggregatePassResult(this, $jp); | ||
| for (const $jp of matchingJps) { | ||
| try { | ||
| const result = this.transformJoinpoint($jp); | ||
| const result = this.transformJoinpoint($jp, data); | ||
| aggResult.pushResult(result); | ||
| } catch (e) { | ||
| if (e instanceof PassTransformationError) { | ||
|
|
@@ -97,7 +98,8 @@ export default abstract class SimplePass extends Pass { | |
| * Transformation to be applied to matching joinpoints | ||
| * | ||
| * @param $jp - Join point to transform | ||
| * @param data - Optional data that may be needed to perform 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base class Pass defines _apply_impl as
_apply_impl($jp: LaraJoinPoint): PassResult, which does not include the optionaldataparameter. 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, thedataparameter 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.