|
@@ -15576,6 +15576,8 @@ def g(x_0 : int)-> int:
|
|
\label{sec:closure-conversion}
|
|
\label{sec:closure-conversion}
|
|
\index{subject}{closure conversion}
|
|
\index{subject}{closure conversion}
|
|
|
|
|
|
|
|
+[TODO: discuss conversion of \code{AnnAssign} to \code{Assign} -Jeremy]
|
|
|
|
+
|
|
The compiling of lexically-scoped functions into top-level function
|
|
The compiling of lexically-scoped functions into top-level function
|
|
definitions is accomplished in the pass \code{convert\_to\_closures}
|
|
definitions is accomplished in the pass \code{convert\_to\_closures}
|
|
that comes after \code{reveal\_functions} and before
|
|
that comes after \code{reveal\_functions} and before
|
|
@@ -15724,7 +15726,7 @@ application, we turn function references into closures.
|
|
\fi}
|
|
\fi}
|
|
{\if\edition\pythonEd
|
|
{\if\edition\pythonEd
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
-FunRefArity(|$f$|, |$n$|)
|
|
|
|
|
|
+FunRef(|$f$|)
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
\fi}
|
|
\fi}
|
|
\end{minipage}
|
|
\end{minipage}
|
|
@@ -15813,7 +15815,7 @@ def lambda_0(fvs_1:tuple[bot,int,tuple[int]],z:int) -> int:
|
|
def f(fvs_2:bot, x:int) -> tuple[Callable[[tuple[],int], int]]
|
|
def f(fvs_2:bot, x:int) -> tuple[Callable[[tuple[],int], int]]
|
|
y = (777,)
|
|
y = (777,)
|
|
y[0] = 4
|
|
y[0] = 4
|
|
- return (lambda_0, y, x)
|
|
|
|
|
|
+ return (lambda_0, x, y)
|
|
|
|
|
|
def main() -> int:
|
|
def main() -> int:
|
|
g = (let clos_3 = (f,) in clos_3[0](clos_3, 5))
|
|
g = (let clos_3 = (f,) in clos_3[0](clos_3, 5))
|