mbeckerle commented on a change in pull request #473:
URL: https://github.com/apache/incubator-daffodil/pull/473#discussion_r562084251



##########
File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
##########
@@ -344,6 +346,16 @@ class VariableMap private(vTable: Map[GlobalQName, 
ArrayBuffer[VariableInstance]
    */
   def readVariable(vrd: VariableRuntimeData, referringContext: ThrowsSDE, 
maybeState: Maybe[ParseOrUnparseState]): DataValuePrimitive = {
     val varQName = vrd.globalQName
+    if (maybeState.isDefined) {
+      vrd.direction match {
+        case VariableDirection.ParseOnly if 
(!maybeState.get.isInstanceOf[PState]) =>
+          maybeState.get.SDW("Attempting to read variable %s which is marked 
as parseOnly during unparsing".format(varQName))
+        case VariableDirection.UnparseOnly if 
(!maybeState.get.isInstanceOf[UState]) =>
+          maybeState.get.SDW("Attempting to read variable %s which is marked 
as unparseOnly during parsing".format(varQName))
+        case _ => // Do nothing

Review comment:
       Definitely make them SDE. We can always weaken them to SDW in the future 
if we find SDE too restrictive. But I think SDE is right. 




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