mbeckerle commented on a change in pull request #218: Implement
dfdl:choiceLength='explicit'
URL: https://github.com/apache/incubator-daffodil/pull/218#discussion_r290497887
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/ChoiceCombinator.scala
##########
@@ -199,8 +206,13 @@ case class ChoiceCombinator(ch: ChoiceTermBase,
alternatives: Seq[Gram])
val mapValues = eventUnparserMap.map { case (k, v) => v
}.toSeq.filterNot(_.isEmpty)
if (mapValues.isEmpty)
new NadaUnparser(null)
- else
- new ChoiceCombinatorUnparser(ch.modelGroupRuntimeData,
eventUnparserMap)
+ else {
+ val cup = new ChoiceCombinatorUnparser(ch.modelGroupRuntimeData,
eventUnparserMap)
+ ch.choiceLengthKind match {
+ case ChoiceLengthKind.Implicit => cup
+ case ChoiceLengthKind.Explicit => new ChoiceLengthUnparser(cup,
ch.choiceRuntimeData, choiceLengthInBits)
Review comment:
You need the choice combinator unparser to dynamically allocate this
ChoiceLengthUnparser at runtime. Not create it here in this grammar-tree.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services