Skip to content

Commit 4cc1e64

Browse files
committed
fix(plc4go/codegen): consider length in bits of parent as parent
Closes #2493
1 parent be10816 commit 4cc1e64

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

code-generation/language/go/src/main/resources/templates/go/complex-type-template.go.ftlh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,11 @@ func (m *_${type.name}) GetLengthInBits(ctx context.Context) uint16 {
831831

832832
<#if type.isDiscriminatedParentTypeDefinition()>
833833
func (m *_${type.name}) getLengthInBits(ctx context.Context) uint16 {
834+
<#if type.parentType.isPresent()>
835+
lengthInBits := uint16(m.${type.getParentType().orElseThrow().name}Contract.(*_${type.getParentType().orElseThrow().name}).getLengthInBits(ctx))
836+
<#else>
834837
lengthInBits := uint16(0)
838+
</#if>
835839
<#list type.fields as field>
836840
<#switch field.typeName>
837841
<#case "array">

plc4go/protocols/opcua/readwrite/model/ExtensionObjectWithMask.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)