stevedlawrence opened a new pull request, #1219:
URL: https://github.com/apache/daffodil/pull/1219

   When we need to add an implied sequence for a choice branch (like when the 
branch is an array), we wrap the branch Term in a ChoiceBranchImpliedSequence, 
which is essentially a Sequence that passes logic through to the underlying 
Term. This allows us to use existing sequence logic such as creating repetition 
parsers for arrays.
   
   However, when we create this ChoiceBranchImpliedSequence we set its xml 
parameter to the xml of the Term it wraps. And because it extends Sequence, it 
does all the normal sequence logic of parsing that xml, even though much of it 
is never used because most logic passes through to the underlying Term.
   
   In most cases, this works fine (although its wasted effort) since all that 
extra work is simply ignored. But, if that XML contains any expressions, things 
can quickly go off the rails as it tries to compile expressions with the 
context of this implied sequence.
   
   To fix this, instead of passing in the XML of the underlying Term, we just 
pass in an empty sequence XML. This means there is no longer any real work for 
the ChoiceBranchImpliedSequence to do, except for be a tool to create the 
necessary repetition parsers to wrap around the Term. Not only does this avoid 
issues with incorrect contexts, but it avoids unnecessary work that is just 
ignored.
   
   DAFFODIL-2887


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