Merge "Use nil pointers for arch property structs" am: 142d4fd01d
am: 3099506f27
Change-Id: I6498fb154ead628568b7b01965de5183747c30b6
This commit is contained in:
@@ -463,6 +463,7 @@ func InitArchModule(m Module,
|
|||||||
|
|
||||||
for _, properties := range base.generalProperties {
|
for _, properties := range base.generalProperties {
|
||||||
propertiesValue := reflect.ValueOf(properties)
|
propertiesValue := reflect.ValueOf(properties)
|
||||||
|
t := propertiesValue.Type()
|
||||||
if propertiesValue.Kind() != reflect.Ptr {
|
if propertiesValue.Kind() != reflect.Ptr {
|
||||||
panic(fmt.Errorf("properties must be a pointer to a struct, got %T",
|
panic(fmt.Errorf("properties must be a pointer to a struct, got %T",
|
||||||
propertiesValue.Interface()))
|
propertiesValue.Interface()))
|
||||||
@@ -476,7 +477,7 @@ func InitArchModule(m Module,
|
|||||||
|
|
||||||
archProperties := &archProperties{}
|
archProperties := &archProperties{}
|
||||||
forEachInterface(reflect.ValueOf(archProperties), func(v reflect.Value) {
|
forEachInterface(reflect.ValueOf(archProperties), func(v reflect.Value) {
|
||||||
newValue := proptools.CloneEmptyProperties(propertiesValue)
|
newValue := reflect.Zero(t)
|
||||||
v.Set(newValue)
|
v.Set(newValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user