Allow dynamically calculated inherit-product path

Bug: 193566316
Test: internal
Change-Id: Iaa7b68cf459f9a694ae9d37a32c9372cf8a8335a
This commit is contained in:
Sasha Smundak
2021-07-22 18:32:56 -07:00
parent e083a05ad0
commit 6609ba7664
7 changed files with 475 additions and 55 deletions

View File

@@ -16,7 +16,6 @@ package mk2rbc
import (
"fmt"
"os"
"strings"
)
@@ -222,15 +221,18 @@ func (pv predefinedVariable) emitGet(gctx *generationContext, _ bool) {
pv.value.emit(gctx)
}
func (pv predefinedVariable) emitSet(_ *generationContext, asgn *assignmentNode) {
func (pv predefinedVariable) emitSet(gctx *generationContext, asgn *assignmentNode) {
if expectedValue, ok1 := maybeString(pv.value); ok1 {
actualValue, ok2 := maybeString(asgn.value)
if ok2 {
if actualValue == expectedValue {
return
}
fmt.Fprintf(os.Stderr, "cannot set predefined variable %s to %q, its value should be %q",
gctx.writef("# MK2RBC TRANSLATION ERROR: cannot set predefined variable %s to %q, its value should be %q",
pv.name(), actualValue, expectedValue)
gctx.newLine()
gctx.write("pass")
gctx.starScript.hasErrors = true
return
}
}