aboutsummaryrefslogtreecommitdiffstats
path: root/androidmk
diff options
context:
space:
mode:
authorJeff Gaston <jeffrygaston@google.com>2017-08-23 17:03:42 -0700
committerJeff Gaston <jeffrygaston@google.com>2017-08-24 22:59:50 +0000
commitf3ccfa9b9936b577bad8b40c363b5e0795ad615c (patch)
tree5db7bf90b5509556714db03d215ab738f10630f7 /androidmk
parentd55f4d01d52e393e9cbe66663feff70c920996a6 (diff)
downloadbuild_soong-f3ccfa9b9936b577bad8b40c363b5e0795ad615c.tar.gz
build_soong-f3ccfa9b9936b577bad8b40c363b5e0795ad615c.tar.bz2
build_soong-f3ccfa9b9936b577bad8b40c363b5e0795ad615c.zip
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
Diffstat (limited to 'androidmk')
-rw-r--r--androidmk/cmd/androidmk/android.go2
-rw-r--r--androidmk/parser/scope.go7
2 files changed, 7 insertions, 2 deletions
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index f853716a..19ed4ecf 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -449,7 +449,7 @@ func sanitize(sub string) func(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 {
ctx.file.scope.Set("BUILD_PREBUILT", v)
} else {
diff --git a/androidmk/parser/scope.go b/androidmk/parser/scope.go
index 5e94ea58..60efac27 100644
--- a/androidmk/parser/scope.go
+++ b/androidmk/parser/scope.go
@@ -1,6 +1,8 @@
package parser
-import "strings"
+import (
+ "strings"
+)
type Scope interface {
Get(name string) string
@@ -84,6 +86,9 @@ func (v Variable) Value(scope Scope) string {
if ret, ok := v.EvalFunction(scope); ok {
return ret
}
+ if scope == nil {
+ panic("Cannot take the value of a variable in a nil scope")
+ }
return scope.Get(v.Name.Value(scope))
}