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:
[email protected]
With regards,
Apache Git Services