stevedlawrence commented on a change in pull request #332: Refactor isHidden
URL: https://github.com/apache/incubator-daffodil/pull/332#discussion_r392956719
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/Term.scala
##########
@@ -612,46 +612,32 @@ trait Term
}.value
/*
- * This function returns at list of simple elements that are descendents of
- * this term that are not defaultable or OVC. This is a requirement for terms
- * inside a hidden group. Note that there is an exception for choices, in
- * which only a single branch be all defaultable or OVC. If any elements in a
- * hidden group are not defaultable or OVC, then it is an SDE. This function
- * assumes it is only called on elements inside of a hidden group.
+ * This function returns a boolean if the values of the term can be figured
+ * out during unparsing or if they don't need to appear in the infoset at
all.
*
- * Note that this currently only requires OVC since default's aren't
- * implemented. This function may need to change when we support defaults.
+ * Usually this means the term/its descendants have a default value (i.e
defaultable),
+ * have defined dfdl:outputValueCalc, or are optional (minOccurs=0)
+ *
+ * Note that this currently only requires OVC and Optionally since defaults
+ * aren't fully implemented everywhere. This function may need to change when
+ * defaults are fully implemented.
*/
- lazy val childrenInHiddenGroupNotDefaultableOrOVC: Seq[ElementBase] = {
- // this should only be called on hidden elements
- val isH = isHidden
- Assert.invariant(isH)
-
+ lazy val isFullyDefaultableOrOVC: Boolean = {
Review comment:
I"m wondering if we could come up with a different name since this also
takes into account optionality but the name does not imply that? From your
first sentence in the comment, maybe something like ``canUnparseIfHidden``.
That way if the logic becomes more complex due to some new feature, we don't
necessarily have to change the name.
----------------------------------------------------------------
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