Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move dunder new resolution to
classes.rs
Summary: I'm looking at how to improve attribute get and set resolution, and for the most part general attribute reads flow through `attr.rs`, which makes for clear layering that makes refactors feasible. But there are a couple of spots where arbitrary parts of `AnswersSolver` are reaching directly into the guts of `classes.rs` - in particular the `Attribute` struct - which is harder to refactor. I think most of these cases are situations where we have a reasonable implementation, but the logic belongs directly in `classes.rs` with a tightly constrained interface, instead of relying on a low-level function that could potentially be used to fetch *any* attribute. This diff moves the `__new__` lookup logic, which is low level in that it wants to see the lineage of `__new__` and therefore cannot rely on the general lookup functions in `attr.rs`, to `classes.rs`. Since this was actually the *only* use of `get_class_attribute_with_targs` I just inlined the functionality, since at the moment I'm not aware of a single other use case where we actually need this kind of lineage to get desired behavior. Reviewed By: ndmitchell, rchen152 Differential Revision: D68599258 fbshipit-source-id: 437a3c01a64d0ee9f9acf754613aaf89e0625143
- Loading branch information