Simplify and correct variable assignments
- Remove asgnMaybeAppend, it was only used to indicate that the asignment needs a setDefault. But really, all types of variable assignments need setDefault if they're self-referential. - Remove local_append/local_set_default because there was no implementation for them written in product_config.rbc anyways. - Correct productConfigVariable.emitDefined using the global variables instead of the product config variables. - Emit setDefaults for all types of assignments if they're self referential. Bug: 222737841 Test: go test Change-Id: I06a0f90f16d5900049d473281e6d5ef5e93e67da
This commit is contained in:
@@ -50,15 +50,12 @@ const (
|
||||
soongNsPrefix = "SOONG_CONFIG_"
|
||||
|
||||
// And here are the functions and variables:
|
||||
cfnGetCfg = baseName + ".cfg"
|
||||
cfnMain = baseName + ".product_configuration"
|
||||
cfnBoardMain = baseName + ".board_configuration"
|
||||
cfnPrintVars = baseName + ".printvars"
|
||||
cfnWarning = baseName + ".warning"
|
||||
cfnLocalAppend = baseName + ".local_append"
|
||||
cfnLocalSetDefault = baseName + ".local_set_default"
|
||||
cfnInherit = baseName + ".inherit"
|
||||
cfnSetListDefault = baseName + ".setdefault"
|
||||
cfnGetCfg = baseName + ".cfg"
|
||||
cfnMain = baseName + ".product_configuration"
|
||||
cfnBoardMain = baseName + ".board_configuration"
|
||||
cfnPrintVars = baseName + ".printvars"
|
||||
cfnInherit = baseName + ".inherit"
|
||||
cfnSetListDefault = baseName + ".setdefault"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -571,11 +568,7 @@ func (ctx *parseContext) handleAssignment(a *mkparser.Assignment) []starlarkNode
|
||||
case "=", ":=":
|
||||
asgn.flavor = asgnSet
|
||||
case "+=":
|
||||
if asgn.previous == nil && !asgn.lhs.isPreset() {
|
||||
asgn.flavor = asgnMaybeAppend
|
||||
} else {
|
||||
asgn.flavor = asgnAppend
|
||||
}
|
||||
asgn.flavor = asgnAppend
|
||||
case "?=":
|
||||
asgn.flavor = asgnMaybeSet
|
||||
default:
|
||||
|
Reference in New Issue
Block a user