stevedlawrence 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_r301547953
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
##########
@@ -943,155 +950,148 @@ sealed abstract class StepExpression(val step: String,
val pred: Option[Predicat
NodeInfo.ArrayIndex
}
+}
+
+sealed abstract class DownStepExpression(s: String, predArg:
Option[PredicateExpression])
+ extends StepExpression(s, predArg) {
+
override lazy val inherentType: NodeInfo.Kind = {
if (!isLastStep) NodeInfo.Complex
else {
- if (stepElement.optPrimType.isDefined) {
+ if (stepElements.head.optPrimType.isDefined) {
// simple type, so
- val pt = stepElement.optPrimType.get
+ val pt = stepElements.head.optPrimType.get
pt
} else {
NodeInfo.Complex
}
}
}
-
}
-//TODO: Is ".[i]" ever a valid expression in DFDL?
+// TODO: Is ".[i]" ever a valid expression in DFDL?
+// Yes. For an array element, .[1] is the first occurrence.
-case class Self(predArg: Option[PredicateExpression]) extends
StepExpression(null, predArg) {
+sealed abstract class SelfStepExpression(s: String, predArg:
Option[PredicateExpression])
+ extends DownStepExpression(s, predArg) {
override lazy val compiledDPath = new CompiledDPath(SelfMove +: conversions)
-
override def text = "."
- override lazy val stepElement: DPathElementCompileInfo =
- priorStep.map { _.stepElement }.getOrElse {
- // no prior step, so we're the first step
- this.compileInfo.elementCompileInfo.getOrElse {
- relPathErr()
+ override lazy val stepElements = stepElementDefs
+
+ protected def stepElementDefs: Seq[DPathElementCompileInfo] = {
+ if (this.isFirstStep) {
+ val ecs = compileInfo.elementCompileInfos
+ if (ecs.isEmpty) {
+ SDE("There is no enclosing element")
Review comment:
What does this error message mean? I don't think I would know how to fix my
expression if I saw this error message.
----------------------------------------------------------------
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]
With regards,
Apache Git Services