Don't recurse into configurable properties in filterPropertyStructFields

filterPropertyStructFields should treat configurable properties as
leaf nodes and not recurse into them. Configurable properties can be
made arch_variant, at least while we transition to full use of
Configurable.

Bug: 323382414
Test: soong tests when changing enabled to be configurable
Change-Id: Ib22dd3797f69e912dab0e0c3c1030d6c1f04db7e
This commit is contained in:
Cole Faust 2024-03-26 16:46:48 -07:00
parent 4f968700d1
commit 02790f32c9
2 changed files with 16 additions and 3 deletions

View file

@ -4125,6 +4125,13 @@ func (c *Context) ModuleErrorf(logicModule Module, format string,
args ...interface{}) error {
module := c.moduleInfo[logicModule]
if module == nil {
// This can happen if ModuleErrorf is called from a load hook
return &BlueprintError{
Err: fmt.Errorf(format, args...),
}
}
return &ModuleError{
BlueprintError: BlueprintError{
Err: fmt.Errorf(format, args...),
@ -4138,8 +4145,14 @@ func (c *Context) PropertyErrorf(logicModule Module, property string, format str
args ...interface{}) error {
module := c.moduleInfo[logicModule]
pos := module.propertyPos[property]
if module == nil {
// This can happen if PropertyErrorf is called from a load hook
return &BlueprintError{
Err: fmt.Errorf(format, args...),
}
}
pos := module.propertyPos[property]
if !pos.IsValid() {
pos = module.pos
}

View file

@ -85,8 +85,8 @@ func filterPropertyStructFields(fields []reflect.StructField, prefix string, max
ptrToStruct = true
}
// Recurse into structs
if ptrToStruct || isStruct(field.Type) {
// Recurse into structs, except if they are configurable properties
if !isConfigurable(field.Type) && (ptrToStruct || isStruct(field.Type)) {
subMaxTypeNameSize := maxTypeNameSize
if maxTypeNameSize > 0 {
// In the worst case where only this nested struct will fit in the outer struct, the