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

Class HeaderDeclaration

mypyc/codegen/emit.py:99–128  ·  view source on GitHub ↗

A representation of a declaration in C. This is used to generate declarations in header files and (optionally) definitions in source files. Attributes: decl: C source code for the declaration. defn: Optionally, C source code for a definition. dependencies: The names o

Source from the content-addressed store, hash-verified

97
98
99class HeaderDeclaration:
100 """A representation of a declaration in C.
101
102 This is used to generate declarations in header files and
103 (optionally) definitions in source files.
104
105 Attributes:
106 decl: C source code for the declaration.
107 defn: Optionally, C source code for a definition.
108 dependencies: The names of any objects that must be declared prior.
109 is_type: Whether the declaration is of a C type. (C types will be declared in
110 external header files and not marked 'extern'.)
111 needs_export: Whether the declared object needs to be exported to
112 other modules in the linking table.
113 """
114
115 def __init__(
116 self,
117 decl: str | list[str],
118 defn: list[str] | None = None,
119 *,
120 dependencies: set[str] | None = None,
121 is_type: bool = False,
122 needs_export: bool = False,
123 ) -> None:
124 self.decl = [decl] if isinstance(decl, str) else decl
125 self.defn = defn
126 self.dependencies = dependencies or set()
127 self.is_type = is_type
128 self.needs_export = needs_export
129
130
131class EmitterContext:

Callers 12

emit_module_exec_funcMethod · 0.90
emit_init_only_funcMethod · 0.90
emit_module_init_funcMethod · 0.90
declare_globalMethod · 0.90
declare_finalsMethod · 0.90
declare_type_varsMethod · 0.90
generate_class_type_declFunction · 0.90
generate_class_reuseFunction · 0.90
generate_object_structFunction · 0.90
declare_tuple_structMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…