diff options
author | 2017-11-29 00:27:14 -0800 | |
---|---|---|
committer | 2017-11-30 00:44:11 +0000 | |
commit | aabf67968c4abc98d94bd8ccd6d612246b2fbbdc (patch) | |
tree | fa6ef71b0fd9ce7746e8a9f6b7f02e353cace36b /android/singleton.go | |
parent | 178d5fefc0cea9d0f031c0bdee125b9d960f32c3 (diff) |
Make *Context.Config return a Config instead of a interface{}
In Soong, a Config() method will always return a Config. Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere. Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.
Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.
Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
Diffstat (limited to 'android/singleton.go')
-rw-r--r-- | android/singleton.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/android/singleton.go b/android/singleton.go index f2f575ff3..87910fdab 100644 --- a/android/singleton.go +++ b/android/singleton.go @@ -21,8 +21,7 @@ import ( // SingletonContext type SingletonContext interface { - // TODO(ccross): make this return an android.Config - Config() interface{} + Config() Config ModuleName(module blueprint.Module) string ModuleDir(module blueprint.Module) string @@ -87,6 +86,10 @@ type singletonContextAdaptor struct { blueprint.SingletonContext } +func (s singletonContextAdaptor) Config() Config { + return s.SingletonContext.Config().(Config) +} + func (s singletonContextAdaptor) Variable(pctx PackageContext, name, value string) { s.SingletonContext.Variable(pctx.PackageContext, name, value) } |