diff options
author | 2024-04-04 10:55:19 -0700 | |
---|---|---|
committer | 2024-04-04 15:09:18 -0700 | |
commit | b78ce43ae30fbce4e20f93d2b9ca072846f406f3 (patch) | |
tree | ccd4e50cd21fae26fc4cd37c91259989f020a2a2 /android/path_properties.go | |
parent | 02dd6e564078fe7f4088a2f158239260d8acebfa (diff) |
Rename Evaluate() to Get() and add GetDefault()
Part of the design of property structs is that they were easy to access.
In keeping with that spirit, use a shorter and easier to spell name
for the getter, and add GetDefault() so that you don't need to pass
the result of Get() to one of the
proptools.StringDefault/BoolDefault/etc functions.
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I0b8df151de59f2cd9463425c6666cbfda6bf47f2
Diffstat (limited to 'android/path_properties.go')
-rw-r--r-- | android/path_properties.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/android/path_properties.go b/android/path_properties.go index ea925654e..6210aee91 100644 --- a/android/path_properties.go +++ b/android/path_properties.go @@ -109,9 +109,9 @@ func pathPropertiesForPropertyStruct(ctx BottomUpMutatorContext, ps interface{}) case reflect.Struct: intf := sv.Interface() if configurable, ok := intf.(proptools.Configurable[string]); ok { - ret = append(ret, proptools.String(configurable.Evaluate(ctx))) + ret = append(ret, configurable.GetOrDefault(ctx, "")) } else if configurable, ok := intf.(proptools.Configurable[[]string]); ok { - ret = append(ret, proptools.Slice(configurable.Evaluate(ctx))...) + ret = append(ret, configurable.GetOrDefault(ctx, nil)...) } else { panic(fmt.Errorf(`field %s in type %s has tag android:"path" but is not a string or slice of strings, it is a %s`, v.Type().FieldByIndex(i).Name, v.Type(), sv.Type())) |