Skip to content

Modeling of Python function defintions

Raffi Khatchadourian edited this page Nov 8, 2023 · 1 revision

Scripts and functions that define functions have a field whose value is the defined function.

For example, below is the IR of a CG node for f() that defines an embedded function g():

0   v2 = new <PythonLoader,Lscript A.py/f/g>@0<no information> [2=[g]]
1   global:global script A.py/f/g = v2       <no information> [2=[g]]
2   putfield v1.< PythonLoader, LRoot, g, <PythonLoader,LRoot> > = v2<no information> [1=[the function]2=[g]]

This also works on the script level for outermost functions:

90   v241 = new <PythonLoader,Lscript A.py/f>@90<no information> [241=[f]]
91   global:global script A.py/f = v241      <no information> [241=[f]]
92   putfield v1.< PythonLoader, LRoot, f, <PythonLoader,LRoot> > = v241<no information> [241=[f]]
Clone this wiki locally