mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Refactor child types
Didn't change the actual syntax, but changed the rules around to be less confusing.
This commit is contained in:
parent
9dcd06de51
commit
71f52d350a
11 changed files with 74 additions and 55 deletions
|
@ -170,11 +170,16 @@ class XmlOutput(OutputFormat):
|
|||
|
||||
def _emit_child(self, child: Child, xml: XmlEmitter):
|
||||
child_type = internal_child = None
|
||||
|
||||
if child.tokens["internal_child"]:
|
||||
internal_child = child.tokens["child_type"]
|
||||
else:
|
||||
child_type = child.tokens["child_type"]
|
||||
if child.annotation is not None:
|
||||
annotation = child.annotation.child
|
||||
if isinstance(annotation, ChildType):
|
||||
child_type = annotation.child_type
|
||||
elif isinstance(annotation, ChildInternal):
|
||||
internal_child = annotation.internal_child
|
||||
elif isinstance(annotation, ChildExtension):
|
||||
child_type = "action"
|
||||
else:
|
||||
raise CompilerBugError()
|
||||
|
||||
xml.start_tag("child", type=child_type, internal_child=internal_child)
|
||||
self._emit_object(child.object, xml)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue