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

Class FuncIR

mypyc/ir/func_ir.py:259–342  ·  view source on GitHub ↗

Intermediate representation of a function with contextual information. Unlike FuncDecl, this includes the IR of the body (basic blocks).

Source from the content-addressed store, hash-verified

257
258
259class FuncIR:
260 """Intermediate representation of a function with contextual information.
261
262 Unlike FuncDecl, this includes the IR of the body (basic blocks).
263 """
264
265 def __init__(
266 self,
267 decl: FuncDecl,
268 arg_regs: list[Register],
269 blocks: list[BasicBlock],
270 line: int = -1,
271 traceback_name: str | None = None,
272 ) -> None:
273 # Declaration of the function, including the signature
274 self.decl = decl
275 # Registers for all the arguments to the function
276 self.arg_regs = arg_regs
277 # Body of the function
278 self.blocks = blocks
279 self.decl.line = line
280 # The name that should be displayed for tracebacks that
281 # include this function. Function will be omitted from
282 # tracebacks if None.
283 self.traceback_name = traceback_name
284
285 @property
286 def line(self) -> int:
287 return self.decl.line
288
289 @property
290 def args(self) -> Sequence[RuntimeArg]:
291 return self.decl.sig.args
292
293 @property
294 def ret_type(self) -> RType:
295 return self.decl.sig.ret_type
296
297 @property
298 def class_name(self) -> str | None:
299 return self.decl.class_name
300
301 @property
302 def sig(self) -> FuncSignature:
303 return self.decl.sig
304
305 @property
306 def name(self) -> str:
307 return self.decl.name
308
309 @property
310 def fullname(self) -> str:
311 return self.decl.fullname
312
313 @property
314 def id(self) -> str:
315 return self.decl.id
316

Callers 15

gen_func_irFunction · 0.90
gen_glue_methodFunction · 0.90
gen_glue_propertyFunction · 0.90
gen_glue_property_setterFunction · 0.90
gen_property_getter_irFunction · 0.90
gen_property_setter_irFunction · 0.90
enter_methodMethod · 0.90
transform_mypy_fileFunction · 0.90
test_valid_fnMethod · 0.90

Calls

no outgoing calls

Tested by 13

test_valid_fnMethod · 0.72
test_valid_gotoMethod · 0.72
test_invalid_gotoMethod · 0.72
test_invalid_assignMethod · 0.72
test_duplicate_opMethod · 0.72
test_pprintMethod · 0.72
test_simpleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…