Generator for C source for a compilation group. The code for a compilation group contains an internal and an external .h file, and then one .c if not in multi_file mode or one .c file per module if in multi_file mode. Arguments: modules: (name, ir) pairs
(
self,
modules: dict[str, ModuleIR],
source_paths: dict[str, str],
group_name: str | None,
group_map: dict[str, str | None],
names: NameGenerator,
compiler_options: CompilerOptions,
)
| 588 | |
| 589 | class GroupGenerator: |
| 590 | def __init__( |
| 591 | self, |
| 592 | modules: dict[str, ModuleIR], |
| 593 | source_paths: dict[str, str], |
| 594 | group_name: str | None, |
| 595 | group_map: dict[str, str | None], |
| 596 | names: NameGenerator, |
| 597 | compiler_options: CompilerOptions, |
| 598 | ) -> None: |
| 599 | """Generator for C source for a compilation group. |
| 600 | |
| 601 | The code for a compilation group contains an internal and an |
| 602 | external .h file, and then one .c if not in multi_file mode or |
| 603 | one .c file per module if in multi_file mode. |
| 604 | |
| 605 | Arguments: |
| 606 | modules: (name, ir) pairs for each module in the group |
| 607 | source_paths: Map from module names to source file paths |
| 608 | group_name: The name of the group (or None if this is single-module compilation) |
| 609 | group_map: A map of modules to their group names |
| 610 | names: The name generator for the compilation |
| 611 | compiler_options: Mypyc specific options, including multi_file mode |
| 612 | """ |
| 613 | self.modules = modules |
| 614 | self.source_paths = source_paths |
| 615 | self.context = EmitterContext( |
| 616 | names, compiler_options.strict_traceback_checks, group_name, group_map |
| 617 | ) |
| 618 | self.names = names |
| 619 | # Initializations of globals to simple values that we can't |
| 620 | # do statically because the windows loader is bad. |
| 621 | self.simple_inits: list[tuple[str, str]] = [] |
| 622 | self.group_name = group_name |
| 623 | self.use_shared_lib = group_name is not None |
| 624 | self.compiler_options = compiler_options |
| 625 | self.multi_file = compiler_options.multi_file |
| 626 | # Multi-phase init is needed to enable free-threading. In the future we'll |
| 627 | # probably want to enable it always, but we'll wait until it's stable. |
| 628 | self.multi_phase_init = IS_FREE_THREADED |
| 629 | |
| 630 | @property |
| 631 | def group_suffix(self) -> str: |
nothing calls this directly
no test coverage detected