Repository navigation
Conversation
| // The elements of a field are reached through the struct. | ||
| PtrKind::Field(root, _, FieldShape::Single) => Ptr { | ||
| offset: 0, | ||
| kind: PtrKind::Field(root.clone(), field_offset(self.offset), FieldShape::Vec), |
There was a problem hiding this comment.
this change doesn't seem related nor useful
There was a problem hiding this comment.
I reverted, it was an attempt to not panic on large offsets
|
I don't like all this decay in the rules. |
For the rules that I changed, decay always runs. Master does decay in converter which is hacky: it uses string comparisons in ConvertFreshObjects. This branch states the decay in the rule. The number of decays is the same. Besides that there are two things that get broken with the master approach:
std::unique_ptr<std::vector<int>> u;
// the receiver of data() has type
// std::unique_ptr<std::vector<int>>::pointer not std::vector<int>*
// ConvertFreshObject does not recognise this pattern
u->data();The above example comes from brunsli |
Rules where the receiver is a Vec or other record must receive
Ptr<Vec<T>>, notPtr<T>:Otherwise they are mis-interpreted as forwarding rules. Forwarding rules are rules for
std::move,std::forward, etc, where the argument is just passed-through the body:This PR also has the nice advantage of dropping unnecessary
as Ptr<T>casts; which makes the code more readable: