Skip to content

[Lara-JS] Refactor SimplePass class#82

Open
milenaaluisa wants to merge 1 commit intostagingfrom
refactor-simplepass
Open

[Lara-JS] Refactor SimplePass class#82
milenaaluisa wants to merge 1 commit intostagingfrom
refactor-simplepass

Conversation

@milenaaluisa
Copy link
Contributor

Refactor SimplePass class to support an optional data parameter in methods _apply_impl and transformJoinpoint.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?: any parameter to _apply_impl method
  • Added optional data?: any parameter to abstract transformJoinpoint method
  • Updated the method call to pass data to transformJoinpoint within _apply_impl

* @returns Results of applying this pass to the given joinpoint
*/
_apply_impl($jp: LaraJoinPoint): AggregatePassResult {
_apply_impl($jp: LaraJoinPoint, data?: any): AggregatePassResult {
Copy link

Copilot AI Feb 18, 2026

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 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.

Copilot uses AI. Check for mistakes.
* @returns The result of the transformation
*/
abstract transformJoinpoint($jp: LaraJoinPoint): PassResult | never;
abstract transformJoinpoint($jp: LaraJoinPoint, data?: any): PassResult | never;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants