diff --git a/blueprintcompiler/ast.py b/blueprintcompiler/ast.py index 6525a54..fc447f3 100644 --- a/blueprintcompiler/ast.py +++ b/blueprintcompiler/ast.py @@ -281,6 +281,8 @@ class Property(AstNode): bind_flags.append("sync-create") if self.tokens["after"]: bind_flags.append("after") + if self.tokens["bidirectional"]: + bind_flags.append("bidirectional") bind_flags_str = "|".join(bind_flags) or None props = { diff --git a/blueprintcompiler/decompiler.py b/blueprintcompiler/decompiler.py index 59735bb..32d3239 100644 --- a/blueprintcompiler/decompiler.py +++ b/blueprintcompiler/decompiler.py @@ -283,6 +283,8 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No flags += " sync-create" if "after" in bind_flags: flags += " after" + if "bidirectional" in bind_flags: + flags += " bidirectional" ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};") elif _truthy(translatable): if context is not None: diff --git a/blueprintcompiler/parser.py b/blueprintcompiler/parser.py index 9ac3fdf..a802df0 100644 --- a/blueprintcompiler/parser.py +++ b/blueprintcompiler/parser.py @@ -77,6 +77,7 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]: ZeroOrMore(AnyOf( Sequence(Keyword("sync-create"), UseLiteral("sync_create", True)), Sequence(Keyword("after"), UseLiteral("after", True)), + Sequence(Keyword("bidirectional"), UseLiteral("bidirectional", True)), )), ) )