Set up a NonExtClassInfo to track dataclass attributes. In addition to setting up a normal extension class for dataclasses, we also collect its class attributes like a non-extension class so that we can hand them to the dataclass decorator.
(self)
| 367 | self.non_ext = self.create_non_ext_info() |
| 368 | |
| 369 | def create_non_ext_info(self) -> NonExtClassInfo: |
| 370 | """Set up a NonExtClassInfo to track dataclass attributes. |
| 371 | |
| 372 | In addition to setting up a normal extension class for dataclasses, |
| 373 | we also collect its class attributes like a non-extension class so |
| 374 | that we can hand them to the dataclass decorator. |
| 375 | """ |
| 376 | return NonExtClassInfo( |
| 377 | self.builder.call_c(dict_new_op, [], self.cdef.line), |
| 378 | self.builder.add(TupleSet([], self.cdef.line)), |
| 379 | self.builder.call_c(dict_new_op, [], self.cdef.line), |
| 380 | self.builder.add(LoadAddress(type_object_op.type, type_object_op.src, self.cdef.line)), |
| 381 | ) |
| 382 | |
| 383 | def skip_attr_default(self, name: str, stmt: AssignmentStmt) -> bool: |
| 384 | return stmt.type is not None |
no test coverage detected