mbeckerle commented on code in PR #974:
URL: https://github.com/apache/daffodil/pull/974#discussion_r1122110345
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala:
##########
@@ -167,6 +167,16 @@ abstract class BinaryIntegerBaseParser(
def parse(start: PState): Unit = {
val nBits = getBitLength(start)
if (nBits == 0) return // zero length is used for outputValueCalc often.
+ if (primNumeric.width.isDefined) {
+ val width = primNumeric.width.get
+ if (nBits > width)
+ PE(
+ start,
Review Comment:
Yup. Poor-man's constant folding using an obvious hack - infoset to be a
fake infoset that just throws if you try to access any method on it. Eval
expression. No infoset access means it can compute the value. If it touches the
infoset, it throws, and determines therefore that it can't constant-fold the
expression.
--
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]