Fix issue with referencing the loop variable in a foreach
Fixes: 222160672 Test: go test Change-Id: I3f9238d4f1684cf4a2d24c4f7f49c832c3f72b97
This commit is contained in:
@@ -595,6 +595,7 @@ func (cx *callExpr) transform(transformer func(expr starlarkExpr) starlarkExpr)
|
|||||||
for i, arg := range cx.args {
|
for i, arg := range cx.args {
|
||||||
argsCopy[i] = arg.transform(transformer)
|
argsCopy[i] = arg.transform(transformer)
|
||||||
}
|
}
|
||||||
|
cx.args = argsCopy
|
||||||
if replacement := transformer(cx); replacement != nil {
|
if replacement := transformer(cx); replacement != nil {
|
||||||
return replacement
|
return replacement
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1228,6 +1228,9 @@ BOOT_KERNEL_MODULES_LIST := foo.ko
|
|||||||
BOOT_KERNEL_MODULES_LIST += bar.ko
|
BOOT_KERNEL_MODULES_LIST += bar.ko
|
||||||
BOOT_KERNEL_MODULES_FILTER_2 := $(foreach m,$(BOOT_KERNEL_MODULES_LIST),%/$(m))
|
BOOT_KERNEL_MODULES_FILTER_2 := $(foreach m,$(BOOT_KERNEL_MODULES_LIST),%/$(m))
|
||||||
|
|
||||||
|
FOREACH_WITH_IF := $(foreach module,\
|
||||||
|
$(BOOT_KERNEL_MODULES_LIST),\
|
||||||
|
$(if $(filter $(module),foo.ko),,$(error module "$(module)" has an error!)))
|
||||||
`,
|
`,
|
||||||
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
expected: `load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
|
||||||
@@ -1238,6 +1241,7 @@ def init(g, handle):
|
|||||||
g["BOOT_KERNEL_MODULES_LIST"] = ["foo.ko"]
|
g["BOOT_KERNEL_MODULES_LIST"] = ["foo.ko"]
|
||||||
g["BOOT_KERNEL_MODULES_LIST"] += ["bar.ko"]
|
g["BOOT_KERNEL_MODULES_LIST"] += ["bar.ko"]
|
||||||
g["BOOT_KERNEL_MODULES_FILTER_2"] = ["%%/%s" % m for m in g["BOOT_KERNEL_MODULES_LIST"]]
|
g["BOOT_KERNEL_MODULES_FILTER_2"] = ["%%/%s" % m for m in g["BOOT_KERNEL_MODULES_LIST"]]
|
||||||
|
g["FOREACH_WITH_IF"] = [("" if rblf.filter(module, "foo.ko") else rblf.mkerror("product.mk", "module \"%s\" has an error!" % module)) for module in g["BOOT_KERNEL_MODULES_LIST"]]
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user