diff options
author | 2021-08-26 09:10:23 -0700 | |
---|---|---|
committer | 2021-09-02 09:34:47 -0700 | |
commit | 468e11fbbefe99168e965b541b5a47ec11032e1d (patch) | |
tree | bd26fffb820d9d4ab6c9a3d9be511decb003c8b8 | |
parent | 5eeb6fc3f2823591677763bee5a87ed7ec0b3681 (diff) |
Additional heuristics: variables with names ending with _LIST are lists
Bug: 193540681
Test: internal
Change-Id: Ic23bf0f0eadb159285650f0b7e20307788c12387
-rw-r--r-- | mk2rbc/mk2rbc_test.go | 2 | ||||
-rw-r--r-- | mk2rbc/variable.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/mk2rbc/mk2rbc_test.go b/mk2rbc/mk2rbc_test.go index 46212ee8b..ca7fe6f23 100644 --- a/mk2rbc/mk2rbc_test.go +++ b/mk2rbc/mk2rbc_test.go @@ -414,7 +414,7 @@ endif def init(g, handle): cfg = rblf.cfg(handle) - if rblf.filter(g.get("PRODUCT_LIST", ""), g["TARGET_PRODUCT"]): + if rblf.filter(g.get("PRODUCT_LIST", []), g["TARGET_PRODUCT"]): pass `, }, diff --git a/mk2rbc/variable.go b/mk2rbc/variable.go index 88d63c96e..4bb9ed52d 100644 --- a/mk2rbc/variable.go +++ b/mk2rbc/variable.go @@ -299,6 +299,10 @@ func (ctx *parseContext) addVariable(name string) variable { vt = vi.valueType } } + if strings.HasSuffix(name, "_LIST") && vt == starlarkTypeUnknown { + // Heuristics: Variables with "_LIST" suffix are lists + vt = starlarkTypeList + } v = &otherGlobalVariable{baseVariable{nam: name, typ: vt}} } ctx.variables[name] = v |