mbeckerle commented on code in PR #1187:
URL: https://github.com/apache/daffodil/pull/1187#discussion_r1528947692
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/runtime1/VariableRuntime1Mixin.scala:
##########
@@ -98,7 +100,10 @@ trait DFDLNewVariableInstanceRuntime1Mixin { self:
DFDLNewVariableInstance =>
defv.namedQName.asInstanceOf[GlobalQName],
defv.primType,
this.tunable.unqualifiedPathStepPolicy,
- this.schemaSet.allDefinedVariables.indexOf(defv),
+ // This is a really important invariant. The index of the NVI's VRD
+ // must be identical to that of the global VRD for this variable,
+ // So we take it from there.
+ vmapIndex = globalVRD.vmapIndex,
Review Comment:
This is a minor improvement to make the invariant here clear because I
wasted a bunch of time thinking that for some reason this was not the same
between NVI VRDs, and regular VRDs. Once I proved they are always the same I
wanted to make that clear in the code.
But there is no functional change here, so I think this change is "no rush".
I have not gotten into why NVI has to really create its own VRD. I.e., how a
variable in an expression ex: $foo:bar gets converted into the NVI VRD, vs. the
global VRD. Maybe it doesn't. I never had to dig in that far.
--
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]