Fix crash when running androidmk against frameworks/base/Android.mk
The was a variable on the right-hand side of the assignment to LOCAL_MODULE_CLASS , which wants a non-nil scope Bug: 64266643 Test: androidmk frameworks/base/Android.mk Test: androidmk prebuilts/misc/common/ddmlib/Android.mk Change-Id: I52d33f5e5cb1179f84d4df149ef804268d67f7fb
This commit is contained in:
@@ -449,7 +449,7 @@ func sanitize(sub string) func(ctx variableAssignmentContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func prebuiltClass(ctx variableAssignmentContext) error {
|
func prebuiltClass(ctx variableAssignmentContext) error {
|
||||||
class := ctx.mkvalue.Value(nil)
|
class := ctx.mkvalue.Value(ctx.file.scope)
|
||||||
if v, ok := prebuiltTypes[class]; ok {
|
if v, ok := prebuiltTypes[class]; ok {
|
||||||
ctx.file.scope.Set("BUILD_PREBUILT", v)
|
ctx.file.scope.Set("BUILD_PREBUILT", v)
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
type Scope interface {
|
type Scope interface {
|
||||||
Get(name string) string
|
Get(name string) string
|
||||||
@@ -84,6 +86,9 @@ func (v Variable) Value(scope Scope) string {
|
|||||||
if ret, ok := v.EvalFunction(scope); ok {
|
if ret, ok := v.EvalFunction(scope); ok {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
if scope == nil {
|
||||||
|
panic("Cannot take the value of a variable in a nil scope")
|
||||||
|
}
|
||||||
return scope.Get(v.Name.Value(scope))
|
return scope.Get(v.Name.Value(scope))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user