|
|
|
@ -65,6 +65,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, |
|
|
|
|
upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, |
|
|
|
|
const upb_FieldDef* f, |
|
|
|
|
upb_Arena* a) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
UPB_ASSERT(upb_FieldDef_IsSubMessage(f) || upb_FieldDef_IsRepeated(f)); |
|
|
|
|
if (upb_FieldDef_HasPresence(f) && !upb_Message_HasFieldByDef(msg, f)) { |
|
|
|
|
// We need to skip the upb_Message_GetFieldByDef() call in this case.
|
|
|
|
@ -103,6 +104,7 @@ make: |
|
|
|
|
|
|
|
|
|
bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
|
|
|
|
upb_MessageValue val, upb_Arena* a) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); |
|
|
|
|
|
|
|
|
|
if (upb_MiniTableField_IsExtension(m_f)) { |
|
|
|
@ -115,6 +117,7 @@ bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
const upb_MiniTableField* m_f = upb_FieldDef_MiniTable(f); |
|
|
|
|
|
|
|
|
|
if (upb_MiniTableField_IsExtension(m_f)) { |
|
|
|
@ -125,6 +128,7 @@ void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
upb_Message_Clear(msg, upb_MessageDef_MiniTable(m)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -186,6 +190,7 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, |
|
|
|
|
|
|
|
|
|
bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, |
|
|
|
|
int depth) { |
|
|
|
|
UPB_ASSERT(!upb_Message_IsFrozen(msg)); |
|
|
|
|
size_t iter = kUpb_Message_Begin; |
|
|
|
|
const upb_FieldDef* f; |
|
|
|
|
upb_MessageValue val; |
|
|
|
|