From 2068e08a2c5c2d7db345f2a46c85509aebcfdf88 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Mon, 5 Oct 2020 14:47:47 -0700 Subject: [PATCH] Correct bug in generating anonymous nested props Some anonymous nested properties are missing from property structs, since setting the property to anonymous is to allow future filtering, there is no issue if we cannot find the struct. test: go bpdoc tests test: m soong_docs --- bootstrap/bpdoc/bpdoc.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bootstrap/bpdoc/bpdoc.go b/bootstrap/bpdoc/bpdoc.go index 1a9d820..8ed02c2 100644 --- a/bootstrap/bpdoc/bpdoc.go +++ b/bootstrap/bpdoc/bpdoc.go @@ -161,10 +161,11 @@ func assembleModuleTypeInfo(r *Reader, name string, factory reflect.Value, } nestedName += proptools.PropertyNameForField(nested.Name) nestedProp := ps.GetByName(nestedName) - if nestedProp == nil { - return nil, fmt.Errorf("could not find nested property %q", nestedName) + // Anonymous properties may have already been omitted, no need to ensure they are filtered later + if nestedProp != nil { + // Set property to anonymous to allow future filtering + nestedProp.SetAnonymous() } - nestedProp.SetAnonymous() } } mt.PropertyStructs = append(mt.PropertyStructs, ps)