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



##########
File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
##########
@@ -286,23 +413,28 @@ class VariableMap private(vTable: Map[GlobalQName, 
MStackOf[VariableInstance]])
   /**
    * Creates a new instance of a variable
    */
-  def newVariableInstance(vrd: VariableRuntimeData) = {
+  def newVariableInstance(vrd: VariableRuntimeData, referringContext: 
ThrowsSDE, state: ParseOrUnparseState) = {
     val varQName = vrd.globalQName
-    val stack = vTable.get(varQName)
-    Assert.invariant(stack.isDefined)
-    stack.get.push(vrd.createVariableInstance)
+    val abuf = vTable.get(varQName)
+    Assert.invariant(abuf.isDefined)
+
+    if (vrd.maybeDefaultValueExpr.isDefined) {
+      val defaultValue = 
DataValue.unsafeFromAnyRef(vrd.maybeDefaultValueExpr.get.evaluate(state))
+      abuf.get += 
vrd.createVariableInstance(VariableUtils.convert(defaultValue.getAnyRef.toString,
 vrd, referringContext))

Review comment:
       I've pushed up changes addressing all your other comments and I've 
created DAFFODIL-2445 to track this issue.




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