(self, lvalue: NameExpr, stmt: AssignmentStmt)
| 330 | handle_ext_method(self.builder, self.cdef, fdef) |
| 331 | |
| 332 | def add_attr(self, lvalue: NameExpr, stmt: AssignmentStmt) -> None: |
| 333 | # Variable declaration with no body |
| 334 | if isinstance(stmt.rvalue, TempNode): |
| 335 | return |
| 336 | # Only treat marked class variables as class variables. |
| 337 | if not (is_class_var(lvalue) or stmt.is_final_def): |
| 338 | return |
| 339 | typ = self.builder.load_native_type_object(self.cdef.fullname) |
| 340 | value = self.builder.accept(stmt.rvalue) |
| 341 | self.builder.primitive_op( |
| 342 | py_setattr_op, [typ, self.builder.load_str(lvalue.name), value], stmt.line |
| 343 | ) |
| 344 | if self.builder.non_function_scope() and stmt.is_final_def: |
| 345 | self.builder.init_final_static(lvalue, value, self.cdef.name) |
| 346 | |
| 347 | def finalize(self, ir: ClassIR) -> None: |
| 348 | # Call __init_subclass__ after class attributes have been set |
nothing calls this directly
no test coverage detected