mbeckerle commented on code in PR #1533:
URL: https://github.com/apache/daffodil/pull/1533#discussion_r2274265648


##########
daffodil-core/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala:
##########
@@ -161,13 +161,28 @@ sealed trait DINode {
   var wouldHaveBeenFreed: Boolean = false
 
   /**
-   * When unparsing, arrays and complex elements have a notion of being 
finalized.
-   * This is when we know that no more elements will be added to them, so 
things
-   * like fn:count can return a value knowing it won't change, and fn:exists 
can
-   * return false, knowing nobody will subsequently append the item that was 
being
-   * questioned.
+   * All node types have a concept of being finalized. When parsing, this is 
used
+   * by the InfosetWalker to know if the element could change (e.g. simple type
+   * modifying the element value, complex or array adding a child) and thus if 
it
+   * can project the element to the target infoset. When unparsing, this is 
used
+   * for comlplex and arrays, so we know if more elements could be added to 
them,
+   * so functions like fn:count can return a value knowing it won't change, and
+   * fn:exists can return false, knowing nobody will subsequently append the 
item
+   * that was being questioned.
    */
-  var isFinal: Boolean = false
+  private var _isFinal: Boolean = false
+
+  /**
+  * Use to mark a node as final, indicating that its value will not change or 
have
+  * any children added to it. This cannot be called if an element is already
+  * marked as final to help ensure correct use of final

Review Comment:
   You should add to this scaladoc that final status does not preclude the 
value being discarded by backtracking, i..e, it's locally final, but might 
still be inside an enclosing PoU. this is the same point you've made elsewhere 
about setFinal is just about local finality. I just think it should also be on 
this scaladoc of the setFinal method. 



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