mbeckerle commented on a change in pull request #259: Incremental progress on 
schema compilation space/speed issue.
URL: https://github.com/apache/incubator-daffodil/pull/259#discussion_r301233698
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
 ##########
 @@ -1103,64 +1104,123 @@ case class NamedStep(s: String, predArg: 
Option[PredicateExpression])
     res
   }
 
-  lazy val dpathElementCompileInfo = stepElement
+  lazy val dpathElementCompileInfos = stepElements
 
   lazy val downwardStep = {
-    if (stepElement.isArray && pred.isDefined) {
-      Assert.invariant(pred.get.targetType == NodeInfo.ArrayIndex)
-      val indexRecipe = pred.get.compiledDPath
-      new DownArrayOccurrence(dpathElementCompileInfo, indexRecipe)
-    } else if (stepElement.isArray && targetType == NodeInfo.Exists) {
-      new DownArrayExists(dpathElementCompileInfo)
-    } else if (stepElement.isArray) {
-      schemaDefinitionUnless(targetType == NodeInfo.Array, "Query-style paths 
not supported. Must have '[...]' after array-element's name. Offending path 
step: '%s'.", step)
-      new DownArray(dpathElementCompileInfo)
+    if (isArray) {
+      if (pred.isDefined) {
+        Assert.invariant(pred.get.targetType == NodeInfo.ArrayIndex)
+        val indexRecipe = pred.get.compiledDPath
+        new DownArrayOccurrence(dpathElementCompileInfos.head, indexRecipe)
+      } else if (targetType == NodeInfo.Exists) {
+        new DownArrayExists(dpathElementCompileInfos.head)
+      } else {
+        schemaDefinitionUnless(targetType == NodeInfo.Array, "Query-style 
paths not supported. Must have '[...]' after array-element's name. Offending 
path step: '%s'.", step)
+        new DownArray(dpathElementCompileInfos.head)
+      }
     } else {
       //
       // Note: DFDL spec allows a[exp] if a is not an array, but it's a 
processing
       // error if exp doesn't evaluate to 1.
       // TODO: Implement this.
       if (pred.isDefined) subsetError("Indexing is only allowed on arrays. 
Offending path step: '%s%s'.", step, pred.get.text)
-      new DownElement(dpathElementCompileInfo)
+      new DownElement(dpathElementCompileInfos.head)
     }
   }
 
   override def text = step
 
-  private def die = {
-    Assert.invariantFailed("should have thrown")
-  }
   /*
-   * The ERD of the element that corresponds to this path step
-   * (or SDE trying to find it.)
+   * The ERDs of the elements that corresponds to this path step
 
 Review comment:
   Grammar error.
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to