stevedlawrence commented on a change in pull request #326: Daffodil 2280
cleanup - removes backpointers and factory patterns no longer needed
URL: https://github.com/apache/incubator-daffodil/pull/326#discussion_r393703243
##########
File path:
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/ChoiceAndOtherVariousUnparsers.scala
##########
@@ -53,11 +86,14 @@ class ChoiceCombinatorUnparser(
case e if e.isEnd && e.isArray => ChoiceBranchEndEvent(e.erd.namedQName)
}
- val childUnparser = eventUnparserMap.get(key).getOrElse {
+ val maybeChildUnparser = eventUnparserMap.get(key)
+ val childUnparser = if (maybeChildUnparser.isEmpty) {
UnparseError(One(mgrd.schemaFileLocation), One(state.currentLocation),
"Found next element %s, but expected one of %s.",
key.qname.toExtendedSyntax,
eventUnparserMap.keys.map { _.qname.toExtendedSyntax }.mkString(", "))
+ } else {
+ maybeChildUnparser.get
}
Review comment:
Maybe easier to read if we do
```scala
if (maybeChildUnpaser.isEmpty) {
UnparseErrror(...)
}
val childUnparser = maybeChildUnparser.get
```
----------------------------------------------------------------
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