Add class attributes to be cached to the global cache.
(
builder: IRBuilder, attrs_to_cache: list[tuple[Lvalue, RType]], cdef: ClassDef
)
| 934 | |
| 935 | |
| 936 | def cache_class_attrs( |
| 937 | builder: IRBuilder, attrs_to_cache: list[tuple[Lvalue, RType]], cdef: ClassDef |
| 938 | ) -> None: |
| 939 | """Add class attributes to be cached to the global cache.""" |
| 940 | typ = builder.load_native_type_object(cdef.info.fullname) |
| 941 | for lval, rtype in attrs_to_cache: |
| 942 | assert isinstance(lval, NameExpr), lval |
| 943 | rval = builder.py_get_attr(typ, lval.name, cdef.line) |
| 944 | builder.init_final_static(lval, rval, cdef.name, type_override=rtype) |
| 945 | |
| 946 | |
| 947 | def create_mypyc_attrs_tuple(builder: IRBuilder, ir: ClassIR, line: int) -> Value: |
no test coverage detected
searching dependent graphs…