Skip to content

Commit

Permalink
porting #200 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Nov 8, 2014
1 parent 829c382 commit cb44b85
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cli/src/main/scala/scalaxb/compiler/xsd2/Generator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,21 @@ class Generator(val schema: ReferenceSchema,
case _ => SEQ(TextClass APPLY(REF("__obj") DOT "value" DOT "toString"))
}
def toXMLArgs: List[Tree] = REF("x") :: (REF("x") DOT "namespace").tree :: (REF("x") DOT "key").tree :: REF("__scope") :: FALSE :: Nil
def childTree: Tree =
def childTree(decl: TaggedType[XComplexType]): Tree =
if (decl.effectiveMixed) (REF("__obj") DOT makeParamName(MIXED_PARAM) DOT "toSeq") FLATMAP LAMBDA(PARAM("x")) ==> BLOCK(
buildToXML(DataRecordAnyClass, toXMLArgs)
)
else if (decl.hasSimpleContent) simpleContentTree(decl.base)
else if (decl.hasSimpleContent)
decl.base match {
case tagged: TaggedComplexType => childTree(tagged)
case _ => simpleContentTree(decl.base)
}
else if (particles.isEmpty) NIL
else if (particles.size == 1) PAREN(buildXMLTree(Param(particles(0), 0)))
else (SeqClass DOT "concat")(Param.fromSeq(particles) map { x => buildXMLTree(x) })

Some(DEF("writesChildNodes", TYPE_SEQ(NodeClass)) withParams(PARAM("__obj", sym),
PARAM("__scope", NamespaceBindingClass)) := childTree)
PARAM("__scope", NamespaceBindingClass)) := childTree(decl))
}

val makeWritesAttribute: Option[Tree] =
Expand Down

0 comments on commit cb44b85

Please sign in to comment.