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

Method declare_tuple_struct

mypyc/codegen/emit.py:572–582  ·  view source on GitHub ↗
(self, tuple_type: RTuple)

Source from the content-addressed store, hash-verified

570 # Higher-level operations
571
572 def declare_tuple_struct(self, tuple_type: RTuple) -> None:
573 if tuple_type.struct_name not in self.context.declarations:
574 dependencies = set()
575 for typ in tuple_type.types:
576 # XXX other types might eventually need similar behavior
577 if isinstance(typ, RTuple):
578 dependencies.add(typ.struct_name)
579
580 self.context.declarations[tuple_type.struct_name] = HeaderDeclaration(
581 self.tuple_c_declaration(tuple_type), dependencies=dependencies, is_type=True
582 )
583
584 def emit_inc_ref(self, dest: str, rtype: RType, *, rare: bool = False) -> None:
585 """Increment reference count of C expression `dest`.

Callers 5

emit_unboxMethod · 0.95
emit_boxMethod · 0.95
generate_object_structFunction · 0.80
generate_native_functionFunction · 0.80
visit_tuple_setMethod · 0.80

Calls 5

tuple_c_declarationMethod · 0.95
setClass · 0.85
isinstanceFunction · 0.85
HeaderDeclarationClass · 0.85
addMethod · 0.45

Tested by

no test coverage detected