bsloane1650 commented on a change in pull request #223: Daffodil 1444 schema 
comp simple types
URL: https://github.com/apache/incubator-daffodil/pull/223#discussion_r289625707
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/ReptypeMixins.scala
 ##########
 @@ -28,23 +28,24 @@ import org.apache.daffodil.processors.RepValueSet
  * need to get a quasi element with said type.
  */
 trait HasOptRepTypeMixinImpl extends SchemaComponent with HasOptRepTypeMixin {
-  
-  override lazy val optRepTypeElement: Option[RepTypeQuasiElementDecl] = 
optRepTypeFactory.map(repType => {
-    val xmlElem = Elem(null, "QuasiElementForTypeCalc", new 
UnprefixedAttribute("type", repType.namedQName.toAttributeNameString, Null), 
namespaces, true)
-    new RepTypeQuasiElementDecl(this.enclosingElement.get, xmlElem, parent)
-  })
+
+  override lazy val optRepTypeElement: Option[RepTypeQuasiElementDecl] =
+    optRepTypeDef.map(repType => {
+      val xmlElem = Elem(null, "QuasiElementForTypeCalc", new 
UnprefixedAttribute("type", repType.namedQName.toAttributeNameString, Null), 
namespaces, true)
+      new RepTypeQuasiElementDecl(xmlElem, lexicalParent)
+    })
 
 }
 
 trait HasOptRepTypeMixin {
-  def optRepTypeFactory: Option[SimpleTypeFactory with NamedMixin]
-  
-  lazy val optRepTypeDefFactory: Option[SimpleTypeDefFactory with NamedMixin] 
= optRepTypeFactory match {
-    case Some(x:SimpleTypeDefFactory) => Some(x)
+  def optRepType: Option[SimpleTypeBase]
+
+  final lazy val optRepTypeDef: Option[SimpleTypeDefBase] = optRepType match {
 
 Review comment:
   Not related to this change, but it might be worth adding a comment 
explaining why we need to distinguish between optRepType and optRepTypeDef. I 
had to scratch my head at this for a few minutes, and I'm the one who wrote 
this in the first place.
   
   I believe the distinction is that it is possible when the repType is a 
primitive type. The resulting type would be difficult (maybe impossible?) to 
use as the type for an element, as the repType is missing any annotations that 
tell Daffodil what the physical characteristics are; however the type can be 
used purely to define a function for use by DPath expressions

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