jadams-tresys commented on a change in pull request #369:
URL: https://github.com/apache/incubator-daffodil/pull/369#discussion_r416559579



##########
File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
##########
@@ -129,54 +156,66 @@ final class VariableBox(initialVMap: VariableMap) {
  * The DPath implementation must be made to implement the
  * no-set-after-default-value-has-been-read behavior. This requires that 
reading the variables causes a state transition.
  */
-class VariableMap private(vTable: Map[GlobalQName, List[List[Variable]]])
+class VariableMap private(vTable: Map[GlobalQName, MStackOf[Variable]])
   extends Serializable {
 
   def this(topLevelVRDs: Seq[VariableRuntimeData] = Nil) =
-    this(topLevelVRDs.map {
+    this(Map(topLevelVRDs.map {
       vrd =>
         val variab = vrd.newVariableInstance
-        (vrd.globalQName, List(List(variab)))
-    }.toMap)
+        val stack = new MStackOf[Variable]
+        stack.push(variab)
+        (vrd.globalQName, stack)
+    }: _*))
 
   override def toString(): String = {
     "VariableMap(" + vTable.mkString(" | ") + ")"
   }
 
+  def copy(): VariableMap = {

Review comment:
       I've updated this to now perform a full deep copy of the entire stack 
for each variable. With how it is currently being called from the original 
DataProcessor's variable map there should only be one variable in each stack, 
but having a full copy function could prove useful in the future anyways.




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


Reply via email to