From c387d372ee42d338ca03d91112370c532c6bc574 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Fri, 9 Sep 2016 14:54:15 -0700 Subject: Added descriptive comment about descriptor nesting. --- upb/descriptor/reader.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'upb/descriptor') diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index 4164bc7..b515840 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -165,6 +165,9 @@ static upb_oneofdef *upb_descreader_getoneof(upb_descreader *r, upb_value val; upb_descreader_frame *f = &r->stack[r->stack_len-1]; + /* DescriptorProto messages can be nested, so we will see the nested messages + * between when we see the FieldDescriptorProto and the OneofDescriptorProto. + * We need to preserve the oneofs in between these two things. */ index += f->oneof_start; while (upb_inttable_count(&r->oneofs) <= index) { -- cgit v1.2.3