Add the ability to check if a property is present

This adds (to the ModuleContext) a facility to check if a property is
defined in a module in a Blueprints file.

Change-Id: I16a35fd236717d8797f15093c019f7cc1049fb3c
This commit is contained in:
David Allison 2014-10-29 14:51:13 -07:00 committed by Colin Cross
parent b6a5039e88
commit 701fbad02b

View file

@ -84,6 +84,7 @@ type DynamicDependerModuleContext interface {
ModuleDir() string
Config() interface{}
ContainsProperty(name string) bool
Errorf(pos scanner.Position, fmt string, args ...interface{})
ModuleErrorf(fmt string, args ...interface{})
PropertyErrorf(property, fmt string, args ...interface{})
@ -119,6 +120,11 @@ func (d *dynamicDependerModuleContext) ModuleName() string {
return d.info.properties.Name
}
func (d *dynamicDependerModuleContext) ContainsProperty(name string) bool {
_, ok := d.info.propertyPos[name]
return ok
}
func (d *dynamicDependerModuleContext) ModuleDir() string {
return filepath.Dir(d.info.relBlueprintsFile)
}