Merge "Ignore variable assignments that come after a rule definition"

This commit is contained in:
Cole Faust
2022-04-27 03:43:02 +00:00
committed by Gerrit Code Review
2 changed files with 4 additions and 2 deletions

View File

@@ -531,7 +531,7 @@ func (ctx *parseContext) backNode() {
func (ctx *parseContext) handleAssignment(a *mkparser.Assignment) []starlarkNode {
// Handle only simple variables
if !a.Name.Const() {
if !a.Name.Const() || a.Target != nil {
return []starlarkNode{ctx.newBadNode(a, "Only simple variables are handled")}
}
name := a.Name.Strings[0]

View File

@@ -1242,13 +1242,15 @@ def init(g, handle):
desc: "Ignore make rules",
mkname: "product.mk",
in: `
foo: PRIVATE_VARIABLE = some_tool $< $@
foo: foo.c
gcc -o $@ $*`,
expected: `load("//build/make/core:product_config.rbc", "rblf")
def init(g, handle):
cfg = rblf.cfg(handle)
rblf.mk2rbc_error("product.mk:2", "unsupported line rule: foo: foo.c\n#gcc -o $@ $*")
rblf.mk2rbc_error("product.mk:2", "Only simple variables are handled")
rblf.mk2rbc_error("product.mk:3", "unsupported line rule: foo: foo.c\n#gcc -o $@ $*")
`,
},
{