jadams-tresys commented on a change in pull request #450:
URL: https://github.com/apache/incubator-daffodil/pull/450#discussion_r539429865
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
##########
@@ -232,19 +345,33 @@ class VariableMap private(vTable: Map[GlobalQName,
MStackOf[VariableInstance]])
*/
def readVariable(vrd: VariableRuntimeData, referringContext: ThrowsSDE,
maybePstate: Maybe[ParseOrUnparseState]): DataValuePrimitive = {
val varQName = vrd.globalQName
- val stack = vTable.get(varQName)
- if (stack.isDefined) {
- val variable = stack.get.top
- variable.state match {
- case VariableRead if (variable.value.isDefined) =>
variable.value.getNonNullable
- case VariableDefined | VariableSet if (variable.value.isDefined) => {
+ val abuf = vTable.get(varQName)
+ if (abuf.isDefined) {
+ val variable = abuf.get.last
+ (variable.state, variable.value.isDefined,
variable.defaultValueExpr.isDefined) match {
+ case (VariableRead, true, _) => variable.value.getNonNullable
+ case (VariableDefined | VariableSet, true, _) => {
if (maybePstate.isDefined && maybePstate.get.isInstanceOf[PState])
Review comment:
There is some book keeping that is specific to parsing only (see the
call to markVariableRead) that doesn't apply to unparsing, hence the check.
I'll go ahead with the rename though.
----------------------------------------------------------------
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]