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
This commit is contained in:
Liz Kammer 2020-10-05 14:47:47 -07:00
parent a10477e361
commit 2068e08a2c

View file

@ -161,10 +161,11 @@ func assembleModuleTypeInfo(r *Reader, name string, factory reflect.Value,
} }
nestedName += proptools.PropertyNameForField(nested.Name) nestedName += proptools.PropertyNameForField(nested.Name)
nestedProp := ps.GetByName(nestedName) nestedProp := ps.GetByName(nestedName)
if nestedProp == nil { // Anonymous properties may have already been omitted, no need to ensure they are filtered later
return nil, fmt.Errorf("could not find nested property %q", nestedName) if nestedProp != nil {
// Set property to anonymous to allow future filtering
nestedProp.SetAnonymous()
} }
nestedProp.SetAnonymous()
} }
} }
mt.PropertyStructs = append(mt.PropertyStructs, ps) mt.PropertyStructs = append(mt.PropertyStructs, ps)