mbeckerle commented on a change in pull request #326: Daffodil 2280 cleanup -
removes backpointers and factory patterns no longer needed
URL: https://github.com/apache/incubator-daffodil/pull/326#discussion_r393768045
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
##########
@@ -234,28 +232,29 @@ trait SchemaComponent
val list = scPath.filter { isComponentForSSCD(_) }
val sscdStrings = list.map { sc =>
sc match {
- case er: AbstractElementRef => "er" + (if (er.position > 1)
er.position else "") + "=" + er.namedQName.toQNameString
+ case er: AbstractElementRef => "er" + (if (er.position > 1)
er.position else "") + "=" + er.refQName.toQNameString
case e: ElementBase => "e" + (if (e.position > 1) e.position else "")
+ "=" +
e.namedQName.toQNameString
- case ed: GlobalElementDecl => ed.factory.shortSchemaComponentDesignator
- case ef: GlobalElementDeclFactory => "e=" + ef.namedQName.toQNameString
+ case ed: GlobalElementDecl => "e=" + ed.namedQName.toQNameString
case ct: GlobalComplexTypeDef => "ct=" + ct.namedQName.toQNameString
case ct: ComplexTypeBase => "ct"
case st: SimpleTypeDefBase => "st=" + st.namedQName.toQNameString
case st: SimpleTypeBase => "st=" +
st.primType.globalQName.toQNameString
case cgr: ChoiceGroupRef => "cgr" + (if (cgr.position > 1)
cgr.position else "") + "=" + cgr.groupDef.namedQName.toQNameString
case cgd: GlobalChoiceGroupDef => "cgd=" + cgd.namedQName.toQNameString
- case sgr: SequenceGroupRef => "sgr" + (if (sgr.isHidden) "h" else "")
+ (if (sgr.position > 1) sgr.position else "") + "=" + sgr.groupDef.namedQName
+ case sgr: SequenceGroupRef => "sgr" + (if (sgr.isHiddenGroupRef) "h"
else "") + (if (sgr.position > 1) sgr.position else "") + "=" +
sgr.groupDef.namedQName
case sgd: GlobalSequenceGroupDef => "sgd=" +
sgd.namedQName.toQNameString
case cg: Choice => "c" + (if (cg.position > 1) cg.position else "")
- case sg: Sequence => "s" + (if (sg.isHidden) "h" else "") + (if
(sg.position > 1) sg.position else "")
- case unknown => Assert.invariantFailed("No SSCD syntax for component:
" + Misc.getNameFromClass(unknown)) // "unk=" + unknown.toString()
+ case sg: Sequence => "s" + (if (sg.position > 1) sg.position else "")
+ case unknown => "unk=" + Misc.getNameFromClass(unknown)
Review comment:
In the future I hope this all to become a sealed trait so that scala will
tell us if we've missed a case here. Right now, I think there are missing cases
form things like Quasi-elements. But it's not clear they should ever have
sscdStrings computed for them, so the unknown clause makes sense. We don't want
this to assert ever because these sscd strings show up in diagnostic messages.
----------------------------------------------------------------
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