Skip to content

Commit

Permalink
fix(code-gen/go): fix issues on combined parent-child assignment too …
Browse files Browse the repository at this point in the history
…early
  • Loading branch information
sruehl committed Sep 25, 2024
1 parent e99779d commit 25239da
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,9 @@ func ${type.name}ParseWithBuffer<#if type.isDiscriminatedParentTypeDefinition()>
func (m *_${type.name}) parse(ctx context.Context, readBuffer utils.ReadBuffer<#if type.isDiscriminatedChildTypeDefinition()>, parent *_${type.getParentType().orElseThrow().name}</#if><#if hasParserArguments>, ${parserArgumentList}</#if>) (__${type.name?uncap_first} ${type.name}, err error) {
<#if type.isDiscriminatedChildTypeDefinition()>
m.${type.getParentType().orElseThrow().name}Contract = parent
parent._SubType = m
<#if !type.isDiscriminatedParentTypeDefinition()>
parent._SubType = m
</#if>
</#if>
positionAware := readBuffer
_ = positionAware
Expand Down Expand Up @@ -1168,6 +1170,9 @@ func (m *_${type.name}) parse(ctx context.Context, readBuffer utils.ReadBuffer<#
}

<#if type.isDiscriminatedParentTypeDefinition()>
<#if type.isDiscriminatedChildTypeDefinition()>
parent._SubType = _child
</#if>
return _child, nil
<#else>
return m, nil
Expand Down

0 comments on commit 25239da

Please sign in to comment.