You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/12/12 17:42:03 UTC

[GitHub] jadams-tresys commented on a change in pull request #153: Add a distinction between how expressions and literals are compiled

jadams-tresys commented on a change in pull request #153: Add a distinction between how expressions and literals are compiled
URL: https://github.com/apache/incubator-daffodil/pull/153#discussion_r241115914
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/CompiledExpression.scala
 ##########
 @@ -91,26 +130,45 @@ class ExpressionCompiler[T <: AnyRef] extends ExpressionCompilerBase[T] {
    * We don't want to allow turning on/off whether a format is delimited or
    * not based on runtime expressions, only what the delimiters are.
    */
-  def compileDelimiter(qn: NamedQName, staticNodeInfoKind: NodeInfo.Kind, runtimeNodeInfoKind: NodeInfo.Kind, property: Found,
+  def compileDelimiter(
+    qn: NamedQName,
+    staticNodeInfoKind: NodeInfo.Kind,
+    runtimeNodeInfoKind: NodeInfo.Kind,
+    property: Found,
     host: OOLAGHost): CompiledExpression[T] = {
+
     val isEvaluatedAbove = false
-    val expr = property.value
+    val exprOrLiteral = property.value
     val namespacesForNamespaceResolution = property.location.namespaces
     val compileInfoWherePropertyWasLocated = propertyCompileInfo(property)
-    val (exprForCompiling, isRealExpression) = exprOrLiteral(expr, staticNodeInfoKind, compileInfoWherePropertyWasLocated)
-    val compiled1 = compileExpression1(qn, staticNodeInfoKind, exprForCompiling, namespacesForNamespaceResolution, compileInfoWherePropertyWasLocated, isEvaluatedAbove, host,
-      isRealExpression)
-    if (compiled1.isConstant) return compiled1
-    if (staticNodeInfoKind == runtimeNodeInfoKind) return compiled1
-    //
-    // TODO: consider passing in a flag or some other way of avoiding this
-    // duplicate compile run.
-
-    // This is, this nodeInfo.Kind is used as the target type in the DPath expression compiler, and
-    //
-    val compiled2 = compileExpression1(qn, runtimeNodeInfoKind, exprForCompiling, namespacesForNamespaceResolution, compileInfoWherePropertyWasLocated,
-      isEvaluatedAbove, host, isRealExpression)
-    compiled2
+    val compiled1 = compileExpression(
+      qn,
+      staticNodeInfoKind,
+      exprOrLiteral,
+      namespacesForNamespaceResolution,
+      compileInfoWherePropertyWasLocated,
+      isEvaluatedAbove,
+      host)
+
+    if (compiled1.isConstant || (staticNodeInfoKind == runtimeNodeInfoKind)) {
+      compiled1
+    } else {
+      //
+      // TODO: consider passing in a flag or some other way of avoiding this
+      // duplicate compile run.
+
+      // This is, this nodeInfo.Kind is used as the target type in the DPath expression compiler, and
 
 Review comment:
   Not sure what is going on with this comment line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services