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

Class EmitterContext

mypyc/codegen/emit.py:131–166  ·  view source on GitHub ↗

Shared emitter state for a compilation group.

Source from the content-addressed store, hash-verified

129
130
131class EmitterContext:
132 """Shared emitter state for a compilation group."""
133
134 def __init__(
135 self,
136 names: NameGenerator,
137 strict_traceback_checks: bool,
138 group_name: str | None = None,
139 group_map: dict[str, str | None] | None = None,
140 ) -> None:
141 """Setup shared emitter state.
142
143 Args:
144 names: The name generator to use
145 group_map: Map from module names to group name
146 group_name: Current group name
147 """
148 self.temp_counter = 0
149 self.names = names
150 self.group_name = group_name
151 self.group_map = group_map or {}
152 # Groups that this group depends on
153 self.group_deps: set[str] = set()
154
155 # The map below is used for generating declarations and
156 # definitions at the top of the C file. The main idea is that they can
157 # be generated at any time during the emit phase.
158
159 # A map of a C identifier to whatever the C identifier declares. Currently this is
160 # used for declaring structs and the key corresponds to the name of the struct.
161 # The declaration contains the body of the struct.
162 self.declarations: dict[str, HeaderDeclaration] = {}
163
164 self.literals = Literals()
165 # See mypyc/options.py for context.
166 self.strict_traceback_checks = strict_traceback_checks
167
168
169class ErrorHandler:

Callers 6

setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
test_simpleMethod · 0.90
test_registerMethod · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 5

setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
test_simpleMethod · 0.72
test_registerMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…