@@ -18031,29 +18031,37 @@ \subsection{Rethrow}
18031
18031
<rethrowStatement> ::= \RETHROW{} `;'
18032
18032
\end{grammar}
18033
18033
18034
+ \LMHash{}%
18035
+ Consider a \RETHROW{} statement $S$.
18036
+ % $f$ as defined below is guaranteed to exist: Every statement occurs in
18037
+ % a <block> (a statement may be part of another statement $S_2$, but by
18038
+ % induction hypothesis $S_2$ occurs in a <block>), and a <block> can only
18039
+ % occur as a statement or in a statement (e.g., in a <finallyPart>), and this
18040
+ % induction can only end in a <functionBody>.
18041
+ Let $f$ be the immediately enclosing function of $S$.
18042
+ A compile-time error occurs unless $S$ is located in an \ON-\CATCH{} clause
18043
+ whose immediately enclosing function is $f$.
18044
+
18034
18045
\LMHash{}%
18035
18046
Execution of a \code{\RETHROW} statement proceeds as follows:
18036
18047
18037
18048
\LMHash{}%
18038
18049
Let $f$ be the immediately enclosing function,
18039
- and let \code{\ON{} $T$ \ CATCH{} ($p_1$, $p_2$)}
18050
+ and let \code{\ON\,\, $T$\,\,\ CATCH\,\, ($p_1$,\,\, $p_2$)}
18040
18051
be the immediately enclosing catch clause (\ref{try}).
18041
18052
18042
18053
\rationale{%
18043
18054
A \RETHROW{} statement always appears inside a \CATCH{} clause,
18044
- and any \CATCH{} clause is semantically equivalent to
18045
- some \CATCH{} clause of the form \ code{\ON{} $T$ \ CATCH{} (p1, p2)}.
18046
- So we can assume that the \RETHROW{} is enclosed in
18055
+ and every \CATCH{} clause is treated as some \CATCH{} clause of the form
18056
+ \ code{\ON\,\, $T$\,\,\ CATCH\,\, (p1,\,\, p2)}.
18057
+ So we can consider the \RETHROW{} statement to be enclosed in
18047
18058
a \CATCH{} clause of that form.%
18048
18059
}
18049
18060
18050
18061
\LMHash{}%
18051
- The \RETHROW{} statement throws (\ref{statementCompletion})
18052
- with $p_1$ as the exception object and $p_2$ as the stack trace.
18053
-
18054
- \LMHash{}%
18055
- It is a compile-time error if a \code{\RETHROW} statement is not
18056
- enclosed within an \ON-\CATCH{} clause.
18062
+ The \RETHROW{} statement then throws (\ref{statementCompletion})
18063
+ with the value of $p_1$ as the exception object,
18064
+ and the value of $p_2$ as the stack trace.
18057
18065
18058
18066
18059
18067
\subsection{Try}
0 commit comments