jadams-tresys commented on a change in pull request #214: Sequences and
Separators Refactoring and Rewrite
URL: https://github.com/apache/incubator-daffodil/pull/214#discussion_r286546340
##########
File path:
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/ZeroLengthDetector.scala
##########
@@ -83,12 +151,34 @@ sealed trait StringZeroLengthMixin { self:
ZeroLengthDetector =>
class StringZeroLengthDetector
extends ZeroLengthDetector
with StringZeroLengthMixin {
- override def isZeroLength(diElement: DIElement) =
isStringZeroLength(diElement)
+ override def isKnownNonZeroLength(diElement: DIElement) =
isStringKnownNonZeroLength(diElement)
+ override def isKnownZeroLength(diElement: DIElement) =
isStringKnownZeroLength(diElement)
}
sealed trait HexBinaryZeroLengthMixin { self: ZeroLengthDetector =>
- protected def isHexBinaryZeroLength(diElement: DIElement): Boolean = {
+
+ protected def isHexBinaryKnownNonZeroLength(diElement: DIElement): Boolean =
{
+ val opt = diElement.erd.optPrimType
+ Assert.invariant(opt.isDefined & (opt.get eq NodeInfo.HexBinary))
+ val result =
+ if (diElement.isNilled)
+ true // must not be zero length nil. If it was zero length nil, we
wouldn't be at this code.
Review comment:
Would it be worth adding an Assert.invariant() here to check for a zero
length nil?
----------------------------------------------------------------
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