They should ignore presence and always process key and value.
Remove codegen for methods in MapEntry and use the ones from Message.
Delete dead code in MapTypeHandler.
PiperOrigin-RevId: 588826780
This change implements maps with keys and values of type string e.g. Map<ProtoStr, i32> and Map<ProtoStr, ProtoStr>.
Implementing the Map type for ProtoStr has been different from scalar types because ProtoStr is an unsized type i.e. its size is not known at compile time. The existing Map implementation assumed sized types in many places. To make unsized types fit into the existing code architecture I have added an associated type 'Value' to the MapWith*KeyOps traits. The associated type needs to be sized and is the type returned by the Map::get(self, key) method e.g. for aProtoStr, the `type Value = &ProtoStr`.
PiperOrigin-RevId: 588783751
accessors_test.rs is getting a bit unwieldy, approaching 1K LOC. This CL breaks out the repeated tests into their own file (accessors_repeated_test.rs), as we expect the tests here to grow. This follows the precedent of `accessors_map_test.rs`.
PiperOrigin-RevId: 588554476
Before this CL, we weren't generating view accessors for messages with depth > 1.
We weren't getting to message::GetterForViewOrMut because we were detecting FieldDescriptor::TYPE_MESSAGE and bailing out.
That check has now been expunged, and we now properly emit the right view, even for messages embedded within messages.
Added tests for:
- another level of submsg access depth
- accessing a message declared outside of the current message (that is, not a direct nested message within the same message)
- accessing the accessor of the accessor of the accessor of a recursively defined message
PiperOrigin-RevId: 588460599
Collect all static initializers in a single expression at the end of the file.
This reduces code bloat, and provides a way to customize the
registration for weak descriptor messages.
PiperOrigin-RevId: 588127128
This will allow us to support editions without adding support for proto2 concepts such as closed enums, required fields, and groups. The generator will now only ban unsupported features, meaning that some types of proto2 files will be allowed. The PHP runtime does not yet support editions.
PiperOrigin-RevId: 588091790