Flatten foreach calls that produce 2d lists
In make, the result of $(foreach $(x),$(y),$(foreach $(z),(w),a)) is a regular list, but in Starlark it's a list of lists. Flatten the results of foreach expressions where each element is a list so that they're regular lists of strings again. Bug: 226974242 Test: go test Change-Id: I3210d409aba0d807a5890e341ab1e0c0478f5930
This commit is contained in:
@@ -1574,11 +1574,21 @@ func (p *foreachCallParser) parse(ctx *parseContext, node mkparser.Node, args *m
|
||||
}
|
||||
}
|
||||
|
||||
return &foreachExpr{
|
||||
var result starlarkExpr = &foreachExpr{
|
||||
varName: loopVarName,
|
||||
list: list,
|
||||
action: action,
|
||||
}
|
||||
|
||||
if action.typ() == starlarkTypeList {
|
||||
result = &callExpr{
|
||||
name: baseName + ".flatten_2d_list",
|
||||
args: []starlarkExpr{result},
|
||||
returnType: starlarkTypeList,
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func transformNode(node starlarkNode, transformer func(expr starlarkExpr) starlarkExpr) {
|
||||
|
Reference in New Issue
Block a user