Skip to content

Refactor: Extract shared addCopyingAndReturn helper for control flow transformations#8754

Merged
davepagurek merged 2 commits intoprocessing:dev-2.0from
LalitNarayanYadav:refactor/strands-extract-copying-helpers
May 3, 2026
Merged

Refactor: Extract shared addCopyingAndReturn helper for control flow transformations#8754
davepagurek merged 2 commits intoprocessing:dev-2.0from
LalitNarayanYadav:refactor/strands-extract-copying-helpers

Conversation

@LalitNarayanYadav
Copy link
Copy Markdown
Contributor

Addresses #8694

Changes:

  • Extracted a shared addCopyingAndReturn helper used by both IfStatement and ForStatement handlers
  • Introduced a sourcePrefix parameter to unify source expression construction:
    • null for IfStatement (direct variable access)
    • 'vars' for ForStatement (loop variable container)
  • Removed duplicated inline implementations from both handlers
  • Updated call sites to use the shared helper

This refactor reduces duplication and improves maintainability without changing behavior. All existing tests pass.


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

@p5-bot
Copy link
Copy Markdown

p5-bot Bot commented May 3, 2026

Continuous Release

CDN link

Published Packages

Commit hash: 0de66f7

Previous deployments

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.

Thanks, looks good!

@davepagurek davepagurek merged commit d82ec0d into processing:dev-2.0 May 3, 2026
3 of 5 checks passed
@LalitNarayanYadav LalitNarayanYadav deleted the refactor/strands-extract-copying-helpers branch May 4, 2026 06:24
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