Skip to content

Refactor: Extract replaceIdentifierReferences and remove reliance on this in ASTCallbacks#8728

Merged
davepagurek merged 2 commits intoprocessing:dev-2.0from
LalitNarayanYadav:refactor/strands-transpiler-pipeline
Apr 27, 2026
Merged

Refactor: Extract replaceIdentifierReferences and remove reliance on this in ASTCallbacks#8728
davepagurek merged 2 commits intoprocessing:dev-2.0from
LalitNarayanYadav:refactor/strands-transpiler-pipeline

Conversation

@LalitNarayanYadav
Copy link
Copy Markdown
Contributor

Addresses #8694

Changes:

  • Extracted replaceIdentifierReferences from ASTCallbacks into a standalone helper function
  • Removed reliance on this binding within ASTCallbacks
  • Replaced all this.replaceIdentifierReferences(...) calls with direct function calls
  • Updated internal callback references (e.g., BinaryExpression, AssignmentExpression) to use explicit ASTCallbacks references
  • Removed the inline helper implementation from ASTCallbacks

This improves modularity and makes the code easier to reason about, while preserving existing behavior.


Screenshots of the change:

N/A (non-visual refactor)


PR Checklist

  • npm run lint passes
  • Inline reference is included / updated
  • Unit tests are included / updated

@LalitNarayanYadav
Copy link
Copy Markdown
Contributor Author

This is the first incremental refactor PR for #8694.

I’ve focused on extracting replaceIdentifierReferences out of ASTCallbacks and removing reliance on this binding, without changing any transformation logic.

The goal is to make the code easier to reason about and prepare for further cleanup in smaller, reviewable steps.

Next steps (planned incremental PRs):

  • Deduplicate BinaryExpression / LogicalExpression handling
  • Introduce a guarded callback wrapper to reduce repeated ancestor checks
  • Extract shared helpers used in control flow transformations
  • Add a high-level pipeline documentation block

Happy to adjust the approach based on feedback before proceeding further.

@p5-bot
Copy link
Copy Markdown

p5-bot Bot commented Apr 27, 2026

Continuous Release

CDN link

Published Packages

Commit hash: 370b85e

Previous deployments

5996f67


This is an automated message.

Copy link
Copy Markdown
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Looks good!

@davepagurek davepagurek merged commit 70147fb into processing:dev-2.0 Apr 27, 2026
5 checks passed
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