rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Widening the type of ForEachLoop.Control.variable to Statement

Open greg-at-moderne opened this issue 7 months ago • 0 comments

What's changed?

In Java:

  • changing the type of ForEachLoop.Control.variable from VariableDeclarations to Statement.

In Javascript:

  • using this to handle cases where for-of or for-in loops use a variable declared before the loop.

What's your motivation?

As designed with @jkschneider and @knutwannheden this is to accommodate a broader set of JS/TS for loops.

Anything in particular you'd like reviewers to focus on?

Note - this slightly changes the API for J.ForEachLoop. As checked before, this will cause some minor compilation issues in a few (roughly around 5) places downstream in openrewrite org.

greg-at-moderne avatar Jun 11 '25 15:06 greg-at-moderne