rewrite
rewrite copied to clipboard
Widening the type of ForEachLoop.Control.variable to Statement
What's changed?
In Java:
- changing the type of
ForEachLoop.Control.variablefromVariableDeclarationstoStatement.
In Javascript:
- using this to handle cases where
for-oforfor-inloops 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.