Matches enhanced for loops; that is, loops of the form for (int i : numbers).
Properties
forLoopEnhanced produces a record that contains the following properties:
| Name | Type | Description |
|---|---|---|
bodyStatement |
statement |
The body of the loop |
containerExpression |
expression |
The container being iterated |
kind |
enum ForLoopKind |
Always `enhanced`;
see ForLoopKind
|
loopVariable |
localVariableSymbol |
The iterator for the loop |
Inherits properties from:
Example
The following CodeXM pattern finds all enhanced for loops over an array of integers:
pattern enhancedForIntegers {
forLoopEnhanced {
.containerExpression == expression {
.type == arrayType {
.elementType == integerType
}
}
}
};