MCPcopy Index your code
hub / github.com/python/mypy / generate_top_level_call

Method generate_top_level_call

mypyc/codegen/emitmodule.py:1452–1462  ·  view source on GitHub ↗

Generate call to function representing module top level.

(self, module: ModuleIR, emitter: Emitter)

Source from the content-addressed store, hash-verified

1450 emitter.emit_lines("}")
1451
1452 def generate_top_level_call(self, module: ModuleIR, emitter: Emitter) -> None:
1453 """Generate call to function representing module top level."""
1454 # Optimization: we tend to put the top level last, so reverse iterate
1455 for fn in reversed(module.functions):
1456 if fn.name == TOP_LEVEL_NAME:
1457 emitter.emit_lines(
1458 f"char result = {emitter.native_function_name(fn.decl)}();",
1459 "if (result == 2)",
1460 " goto fail;",
1461 )
1462 break
1463
1464 def toposort_declarations(self) -> list[HeaderDeclaration]:
1465 """Topologically sort the declaration dict by dependencies.

Callers 1

emit_module_exec_funcMethod · 0.95

Calls 3

reversedFunction · 0.85
native_function_nameMethod · 0.80
emit_linesMethod · 0.45

Tested by

no test coverage detected