Skip to content

Commit

Permalink
fix(codegen/plc4go): fix issue with broken optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl authored and chrisdutz committed Nov 17, 2021
1 parent d3d22f1 commit 7df1184
Show file tree
Hide file tree
Showing 60 changed files with 2,392 additions and 2,620 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,9 +838,7 @@ func ${type.name}Parse(readBuffer utils.ReadBuffer<#if hasParserArguments>, ${pa
curPos = readBuffer.GetPos() - startPos
</#if>
var ${optionalField.name} *${helper.getLanguageTypeNameForField(field)} = nil
<#if optionalField.conditionExpression.present>
if ${helper.toBooleanParseExpression(optionalField.conditionExpression.get(), parserArguments)} {
</#if>
<#if optionalField.conditionExpression.present>if ${helper.toBooleanParseExpression(optionalField.conditionExpression.get(), parserArguments)} </#if>{
<#if helper.isSimpleTypeReference(optionalField.type)>
_val, _err := ${helper.getReadBufferReadMethodCall(optionalField.name, optionalField.type.asSimpleTypeReference().orElseThrow())}
if _err != nil {
Expand Down Expand Up @@ -891,9 +889,7 @@ func ${type.name}Parse(readBuffer utils.ReadBuffer<#if hasParserArguments>, ${pa
}
${optionalField.name} = Cast${helper.getLanguageTypeNameForField(field)}(_val)
</#if>
<#if optionalField.conditionExpression.present>
}
</#if>
<#break>
<#case "assert">
<#assign assertField = field.asAssertField().orElseThrow()>
Expand Down
36 changes: 18 additions & 18 deletions plc4go/internal/plc4go/abeth/readwrite/XmlParserHelper.go

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

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

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

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

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

Loading

0 comments on commit 7df1184

Please sign in to comment.