mbeckerle commented on a change in pull request #343: Daffodil 2302 fixes 
external variables API difficulties
URL: https://github.com/apache/incubator-daffodil/pull/343#discussion_r400549417
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/compiler/Compiler.scala
 ##########
 @@ -73,190 +73,169 @@ object ForParser extends ParserOrUnparser
 object ForUnparser extends ParserOrUnparser
 object BothParserAndUnparser extends ParserOrUnparser
 
-final class ProcessorFactory(val sset: SchemaSet)
-  extends SchemaComponentImpl(<pf/>, sset)
-  with DFDL.ProcessorFactory
-  with HavingRootSpec {
-
-  lazy val (generateParser, generateUnparser) = {
-    val (context, policy) = tunable.parseUnparsePolicy match {
-      case ParseUnparsePolicyTunable.FromRoot => (Some(rootElem), 
rootElem.rootParseUnparsePolicy)
-      case ParseUnparsePolicyTunable.ParseOnly => (None, 
ParseUnparsePolicy.ParseOnly)
-      case ParseUnparsePolicyTunable.UnparseOnly => (None, 
ParseUnparsePolicy.UnparseOnly)
-      case ParseUnparsePolicyTunable.Both => (None, ParseUnparsePolicy.Both)
-    }
-    rootElem.checkParseUnparsePolicyCompatibility(context, policy)
-    policy match {
-      case ParseUnparsePolicy.Both => (true, true)
-      case ParseUnparsePolicy.ParseOnly => (true, false)
-      case ParseUnparsePolicy.UnparseOnly => (false, true)
-    }
+final class ProcessorFactory private(
+  private var optRootSpec: Option[RootSpec],
+  /*
+   * compilerExternalVarSettings supports the deprecated API
+   * where external variable settings can be supplied to the compiler
+   * instance.
+   *
+   * The non-deprecated API is to deal with external variable settings
+   * on the data processor instance. This is passed here so that
+   * the PF can propagate it to the DP.
+   */
+  var compilerExternalVarSettings: Queue[Binding],
 
 Review comment:
   Why is this a Queue of bindings? There is no "unset" for external variables, 
so while you could depend on order that they are being set to overwrite one 
with a new value, it's not a general technique because if you want the variable 
back to its default value "whatever that is", there's no way to express that.

----------------------------------------------------------------
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

Reply via email to