public class LoopVariantASTTransformation
extends Object
implements ASTTransformation, CompilationUnitAware
Handles Decreases annotations placed on loop statements (for,
while, do-while). The closure must return a value that
strictly decreases on every iteration and remains non-negative.
The transformation injects code to:
Example:
int n = 10
@Decreases({ n })
while (n > 0) {
n--
}
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
setCompilationUnit(CompilationUnit unit) |
|
public void |
visit(ASTNode[] nodes, SourceUnit source)Rewrites a loop-level Decreases annotation into variant bookkeeping and runtime checks. |
Rewrites a loop-level Decreases annotation into variant bookkeeping and runtime checks.
nodes - the annotated AST nodes supplied by the compilersource - the current source unit