mbeckerle commented on a change in pull request #468:
URL: https://github.com/apache/incubator-daffodil/pull/468#discussion_r542602538
##########
File path:
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SpecifiedLengthUnparsers.scala
##########
@@ -385,8 +388,11 @@ class SpecifiedLengthPrefixedUnparser(
override lazy val childProcessors = Vector(prefixedLengthUnparser, eUnparser)
override def unparse(state: UState): Unit = {
- // create a "detached" element that the prefix length will be used to
unparse
- val plElem = Infoset.newElement(prefixedLengthERD).asInstanceOf[DISimple]
+ // Create a "detached" DIDocument with a single child element that the
+ // prefix length will be parsed to. This creates a completely new
+ // infoset and parses to that, so care is taken to ensure this infoset
+ // is only used for the prefix length parsing and is removed afterwards
+ val plElem = Infoset.newDetachedElement(state,
prefixedLengthERD).asInstanceOf[DISimple]
Review comment:
I'm a bit concerned about the overhead of this added node, but we should
deal with that via profiling. There are many many overheads in Daffodil, no
reason to think this one will be the most important.
----------------------------------------------------------------
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]