You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/06/04 21:08:08 UTC

[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #218: Implement dfdl:choiceLength='explicit'

mbeckerle commented on a change in pull request #218: Implement dfdl:choiceLength='explicit'
URL: https://github.com/apache/incubator-daffodil/pull/218#discussion_r290496851
 
 

 ##########
 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:
   I think this won't work. ChoiceLengthUnparser has slots in it that are side-effected at runtime to capture length. That won't work if the unparser is being shared across threads.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services