MCPcopy Create free account
hub / github.com/Nuitka/Nuitka / getAsyncgenObjectCode

Function getAsyncgenObjectCode

nuitka/code_generation/AsyncgenCodes.py:48–142  ·  view source on GitHub ↗
(
    context,
    function_identifier,
    closure_variables,
    user_variables,
    outline_variables,
    temp_variables,
    needs_exception_exit,
    needs_generator_return,
)

Source from the content-addressed store, hash-verified

46
47
48def getAsyncgenObjectCode(
49 context,
50 function_identifier,
51 closure_variables,
52 user_variables,
53 outline_variables,
54 temp_variables,
55 needs_exception_exit,
56 needs_generator_return,
57):
58 # A bit of details going on here, pylint: disable=too-many-locals
59
60 setupFunctionLocalVariables(
61 context=context,
62 parameters=None,
63 closure_variables=closure_variables,
64 user_variables=user_variables + outline_variables,
65 temp_variables=temp_variables,
66 )
67
68 function_codes = SourceCodeCollector()
69
70 asyncgen_object_body = context.getOwner()
71
72 generateStatementSequenceCode(
73 statement_sequence=asyncgen_object_body.subnode_body,
74 allow_none=True,
75 emit=function_codes,
76 context=context,
77 )
78
79 function_cleanup = finalizeFunctionLocalVariables(context)
80
81 if needs_exception_exit:
82 (
83 exception_state_name,
84 _exception_lineno,
85 ) = context.variable_storage.getExceptionVariableDescriptions()
86
87 generator_exit = template_asyncgen_exception_exit % {
88 "function_cleanup": indented(function_cleanup),
89 "exception_state_name": exception_state_name,
90 }
91 else:
92 generator_exit = template_asyncgen_no_exception_exit % {
93 "function_cleanup": indented(function_cleanup)
94 }
95
96 if needs_generator_return:
97 generator_exit += template_asyncgen_return_exit % {}
98
99 function_locals = context.variable_storage.makeCFunctionLevelDeclarations()
100
101 local_type_decl = context.variable_storage.makeCStructLevelDeclarations()
102 function_locals += context.variable_storage.makeCStructInits()
103
104 if local_type_decl:
105 heap_declaration = """\

Callers 1

generateFunctionBodyCodeFunction · 0.85

Calls 15

SourceCodeCollectorClass · 0.85
indentedFunction · 0.85
getFunctionCreationArgsFunction · 0.85
getModuleAccessCodeFunction · 0.85
getFunctionQualnameObjFunction · 0.85
getCodeObjectAccessCodeFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…