stevedlawrence commented on code in PR #1218:
URL: https://github.com/apache/daffodil/pull/1218#discussion_r1569091547


##########
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/UnseparatedSequenceUnparsers.scala:
##########
@@ -107,78 +106,58 @@ class OrderedUnseparatedSequenceUnparser(
           // startArray event. If we don't then
           // the element must be entirely optional, so we get no events for it
           // at all.
-          //
-          if (state.inspect) {
-            val ev = state.inspectAccessor
+
+          // we must have an event
+          Assert.invariant(state.inspect, "No event for unparing.")
+
+          val ev = state.inspectAccessor
+          if (ev.erd eq erd) {
+            // must be a start event for this array/optional unparser
             val isArr = ev.isArray
-            if (ev.isStart && (isArr || ev.erd.isOptional)) {
-              val eventNQN = ev.namedQName
-              if (ev.erd eq erd) {
-                //
-                // StartArray for this unparser's array element
-                //
-                unparser.startArrayOrOptional(state)
-                while ({
-                  doUnparser = unparser.shouldDoUnparser(unparser, state)
-                  doUnparser
-                }) {
-                  if (isArr)
-                    if (state.dataProc.isDefined)
-                      state.dataProc.get.beforeRepetition(state, this)
-
-                  unparseOne(unparser, erd, state)
-                  numOccurrences += 1
-                  state.moveOverOneArrayIterationIndexOnly()
-                  state.moveOverOneOccursIndexOnly()
-                  state.moveOverOneGroupIndexOnly() // array elements are 
always represented.
-
-                  if (isArr)
-                    if (state.dataProc.isDefined)
-                      state.dataProc.get.afterRepetition(state, this)
-                }
-
-                unparser.checkFinalOccursCountBetweenMinAndMaxOccurs(
-                  state,
-                  unparser,
-                  numOccurrences,
-                  maxReps,
-                  state.arrayIterationPos - 1,
-                )
-                unparser.endArrayOrOptional(erd, state)

Review Comment:
   Note that this logic is all unchanged, this is just an indentation change. 
It might be helpful to hide whitespace when reviewing this.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to