stevedlawrence commented on a change in pull request #450:
URL: https://github.com/apache/incubator-daffodil/pull/450#discussion_r539525527
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/unparsers/UState.scala
##########
@@ -343,8 +343,8 @@ abstract class UState(
def documentElement: DIDocument
- def newVariableInstance(vrd: VariableRuntimeData): Unit = {
- variableMap.newVariableInstance(vrd)
+ def newVariableInstance(vrd: VariableRuntimeData, ustate: UState): Unit = {
+ variableMap.newVariableInstance(vrd, ustate)
Review comment:
Same as above comment, I think this can be ``this`` instead of ustate.
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/PState.scala
##########
@@ -343,8 +343,8 @@ final class PState private (
changedVariablesStack.top += vrd.globalQName
}
- def newVariableInstance(vrd: VariableRuntimeData): Unit = {
- variableMap.newVariableInstance(vrd)
+ def newVariableInstance(vrd: VariableRuntimeData, pstate: PState): Unit = {
+ variableMap.newVariableInstance(vrd, pstate)
Review comment:
Can this be ``variableMap.newVariableInstance(vrd, this)``? Then when
you do state.newVariableInstance, you don't have to pass in the state variable,
since it's always the same as ``this``.
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/VariableMap1.scala
##########
@@ -188,24 +283,42 @@ class VariableMap private(vTable: Map[GlobalQName,
MStackOf[VariableInstance]])
* VariableInstances are mutable and cannot safely be shared across threads
*/
def copy(): VariableMap = {
- val table = Map[GlobalQName, MStackOf[VariableInstance]]()
- vTable.foreach { case (k: GlobalQName, s: MStackOf[VariableInstance]) => {
- val newStack= new MStackOf[VariableInstance]()
+ val table = Map[GlobalQName, ArrayBuffer[VariableInstance]]()
+ vTable.foreach { case (k: GlobalQName, abuf:
ArrayBuffer[VariableInstance]) => {
+ val newBuf = new ArrayBuffer[VariableInstance]()
// toList provides a list in LIFO order, so we need to reverse it to
// maintain order
- s.toList.reverse.foreach { case v: VariableInstance =>
newStack.push(v.copy()) }
- table(k) = newStack
+ abuf.foreach { case v: VariableInstance => { newBuf += v.copy() }}
Review comment:
Doesn't look like you changed foreach to map, was this just missed or
does it not work?
----------------------------------------------------------------
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]