Generate call to function representing module top level.
(self, module: ModuleIR, emitter: Emitter)
| 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. |
no test coverage detected