Skip to content

Commit

Permalink
fix(code-gen/go): add support for typeswitch in typeswitch
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 24, 2024
1 parent aaf78d9 commit fdeb863
Show file tree
Hide file tree
Showing 31 changed files with 7,973 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public boolean isWildcard(Term term) {
}

/**
* can be used to throw a exception from the template
* can be used to throw an exception from the template
*
* @param message the message
* @return the exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,13 @@ type _${type.name} struct {
}

<#if type.isDiscriminatedParentTypeDefinition()>
<#assign complexTypeDefinition = type.asComplexTypeDefinition().orElseThrow()>
type _${type.name}ChildRequirements interface {
utils.Serializable
GetLengthInBits(ctx context.Context) uint16
<#list complexTypeDefinition.getDiscriminatorNames() as discriminatorName>
<#list helper.discriminatorTypes as discriminatorName, discriminatorType>
<#-- If the discriminator name matches that of another field, suppress the methods generation -->
<#if type.isDiscriminatorField(discriminatorName)>
<#assign typeRef=helper.getDiscriminatorTypes()[discriminatorName]>
Get${discriminatorName?cap_first}() <#if typeRef.isNonSimpleTypeReference() && !typeRef.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(typeRef)}
Get${discriminatorName?cap_first}() <#if discriminatorType.isNonSimpleTypeReference() && !discriminatorType.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(discriminatorType)}
</#if>
</#list>
<#list type.abstractFields as field>
Expand All @@ -188,7 +186,7 @@ type _${type.name}ChildRequirements interface {
<#list discriminatedChildType.getDiscriminatorMap() as discriminatorName, discriminatorTerm>
<#-- If the discriminator name matches that of another field, suppress the methods generation -->
<#if !type.isNonDiscriminatorField(discriminatorName)>
<#assign typeRef=helper.getDiscriminatorTypes()[discriminatorName]>
<#assign typeRef=helper.getDiscriminatorTypes(discriminatedChildType.parentType.orElseThrow())[discriminatorName]>
func (m *_${type.name}) Get${discriminatorName?cap_first}() <#if typeRef.isNonSimpleTypeReference() && !typeRef.isEnumTypeReference()>I</#if>${helper.getLanguageTypeNameForTypeReference(typeRef)} {
<@compress single_line=true>
return
Expand Down
250 changes: 249 additions & 1 deletion plc4go/internal/bacnetip/mock_APCI_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fdeb863

Please sign in to comment.