diff --git a/context_test.go b/context_test.go index 6308ba9..6b9b599 100644 --- a/context_test.go +++ b/context_test.go @@ -461,17 +461,17 @@ func createTestMutator(ctx TopDownMutatorContext) { Deps []string } - ctx.CreateModule(newBarModule, &props{ + ctx.CreateModule(newBarModule, "new_bar", &props{ Name: "B", Deps: []string{"D"}, }) - ctx.CreateModule(newBarModule, &props{ + ctx.CreateModule(newBarModule, "new_bar", &props{ Name: "C", Deps: []string{"D"}, }) - ctx.CreateModule(newFooModule, &props{ + ctx.CreateModule(newFooModule, "new_foo", &props{ Name: "D", }) } diff --git a/module_ctx.go b/module_ctx.go index 787f483..b241712 100644 --- a/module_ctx.go +++ b/module_ctx.go @@ -862,7 +862,7 @@ type TopDownMutatorContext interface { // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies // the specified property structs to it as if the properties were set in a blueprint file. - CreateModule(ModuleFactory, ...interface{}) Module + CreateModule(ModuleFactory, string, ...interface{}) Module } type BottomUpMutatorContext interface { @@ -1228,13 +1228,14 @@ func (mctx *mutatorContext) Rename(name string) { mctx.rename = append(mctx.rename, rename{mctx.module.group, name}) } -func (mctx *mutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module { +func (mctx *mutatorContext) CreateModule(factory ModuleFactory, typeName string, props ...interface{}) Module { module := newModule(factory) module.relBlueprintsFile = mctx.module.relBlueprintsFile module.pos = mctx.module.pos module.propertyPos = mctx.module.propertyPos module.createdBy = mctx.module + module.typeName = typeName for _, p := range props { err := proptools.AppendMatchingProperties(module.properties, p, nil)