mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add lambda expressions
This commit is contained in:
parent
012bdf6843
commit
fc497ac9e6
18 changed files with 247 additions and 80 deletions
|
@ -18,6 +18,7 @@
|
|||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
|
||||
from .types import ClassName
|
||||
from .gobject_object import Object, ObjectContent
|
||||
from .common import *
|
||||
|
||||
|
@ -27,8 +28,8 @@ class Template(Object):
|
|||
"template",
|
||||
UseIdent("name").expected("template class name"),
|
||||
Optional([
|
||||
Match(":"),
|
||||
class_name.expected("parent class"),
|
||||
":",
|
||||
to_parse_node(ClassName).expected("parent class"),
|
||||
]),
|
||||
ObjectContent,
|
||||
]
|
||||
|
@ -38,10 +39,14 @@ class Template(Object):
|
|||
pass # does not apply to templates
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
parent = None
|
||||
if len(self.children[ClassName]):
|
||||
parent = self.children[ClassName][0].glib_type_name
|
||||
|
||||
xml.start_tag(
|
||||
"template",
|
||||
**{"class": self.tokens["name"]},
|
||||
parent=self.gir_class or self.tokens["class_name"]
|
||||
parent=parent,
|
||||
)
|
||||
for child in self.children:
|
||||
child.emit_xml(xml)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue