From 57d36c1d9da193448f58b35ce043ae55f71d9c82 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 28 Jul 2021 10:59:07 -0700 Subject: [PATCH] addrs: ModuleInstance.ChildCall method This allows us to concisely construct AbsModuleCall address values by method chaining from module instance addresses. --- internal/addrs/module_instance.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/addrs/module_instance.go b/internal/addrs/module_instance.go index 21afcb077..f197dc144 100644 --- a/internal/addrs/module_instance.go +++ b/internal/addrs/module_instance.go @@ -237,6 +237,15 @@ func (m ModuleInstance) Child(name string, key InstanceKey) ModuleInstance { }) } +// ChildCall returns the address of a module call within the receiver, +// identified by the given name. +func (m ModuleInstance) ChildCall(name string) AbsModuleCall { + return AbsModuleCall{ + Module: m, + Call: ModuleCall{Name: name}, + } +} + // Parent returns the address of the parent module instance of the receiver, or // the receiver itself if there is no parent (if it's the root module address). func (m ModuleInstance) Parent() ModuleInstance {