next up previous contents index
Next: while statements Up: Applying the simplify algorithm Previous: Interfaces.   Contents   Index

if, switch, and synchronized statements

Consider the statement

\verb$if($$e$\verb$) $$S$\end{tabbing}\end{minipage}\end{displaymath}

where $e$ is an expression and $S$ is a statement. As usual, $\mbox{\it INITS}$ and $e'$ are the results of applying the simplify algorithm to $e$. If $e' = e$, i.e. no simplification is required, the transformed version is just

\verb$if($$e$\verb$) $$S'$\end{tabbing}\end{minipage}\end{displaymath}

where $S'$ is the pre-translated version of $S$. Otherwise the transformed version is

\verb${$ \\
...if($$e'$\verb$) $$S'$ \\

The if-else, switch and synchronized statements follow exactly the same pattern.

Bryan Carpenter 2003-04-15