From 9160ec4e4d9d9976b5457aa3a9d373b47159c4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Thu, 21 Sep 2023 16:16:50 -0700 Subject: [PATCH] add helper to get effective argument labels of composite type initializer --- runtime/sema/type.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/runtime/sema/type.go b/runtime/sema/type.go index b14ba71e89..20b942aede 100644 --- a/runtime/sema/type.go +++ b/runtime/sema/type.go @@ -4795,6 +4795,22 @@ func (t *CompositeType) InitializerFunctionType() *FunctionType { } } +func (t *CompositeType) InitializerEffectiveArgumentLabels() []string { + parameters := t.ConstructorParameters + if len(parameters) == 0 { + return nil + } + + argumentLabels := make([]string, 0, len(parameters)) + for _, parameter := range parameters { + argumentLabels = append( + argumentLabels, + parameter.EffectiveArgumentLabel(), + ) + } + return argumentLabels +} + // Member type Member struct {