fix: replace non-existing bind flag with existing one

Replace non-existing `after` binding flag with `invert-boolean` flag. Use `inverted` name for convenience.
This commit is contained in:
Gleb Smirnov 2022-01-21 20:00:59 +03:00 committed by James Westman
parent cc8a555f97
commit e4283ed0c1
3 changed files with 5 additions and 5 deletions

View file

@ -287,8 +287,8 @@ class Property(AstNode):
bind_flags = [] bind_flags = []
if self.tokens["sync_create"]: if self.tokens["sync_create"]:
bind_flags.append("sync-create") bind_flags.append("sync-create")
if self.tokens["after"]: if self.tokens["inverted"]:
bind_flags.append("after") bind_flags.append("invert-boolean")
if self.tokens["bidirectional"]: if self.tokens["bidirectional"]:
bind_flags.append("bidirectional") bind_flags.append("bidirectional")
bind_flags_str = "|".join(bind_flags) or None bind_flags_str = "|".join(bind_flags) or None

View file

@ -283,8 +283,8 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No
if bind_flags: if bind_flags:
if "sync-create" in bind_flags: if "sync-create" in bind_flags:
flags += " sync-create" flags += " sync-create"
if "after" in bind_flags: if "invert-boolean" in bind_flags:
flags += " after" flags += " inverted"
if "bidirectional" in bind_flags: if "bidirectional" in bind_flags:
flags += " bidirectional" flags += " bidirectional"
ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};") ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};")

View file

@ -76,7 +76,7 @@ def parse(tokens) -> T.Tuple[ast.UI, T.Optional[MultipleErrors]]:
UseIdent("bind_property").expected("a property name to bind from"), UseIdent("bind_property").expected("a property name to bind from"),
ZeroOrMore(AnyOf( ZeroOrMore(AnyOf(
Sequence(Keyword("sync-create"), UseLiteral("sync_create", True)), Sequence(Keyword("sync-create"), UseLiteral("sync_create", True)),
Sequence(Keyword("after"), UseLiteral("after", True)), Sequence(Keyword("inverted"), UseLiteral("invert-boolean", True)),
Sequence(Keyword("bidirectional"), UseLiteral("bidirectional", True)), Sequence(Keyword("bidirectional"), UseLiteral("bidirectional", True)),
)), )),
) )