mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
decompiler: Add more decompilable tags
Add more tags to the list of things the decompiler can handle. This required some changes to track the containing object class in the DecompileCtx, since some objects use the same tag names. The improved support means we can test the decompiler on most of the test suite. Any new test samples will by default be tested to ensure the decompiler produces the original blueprint file. Also, updated the decompiler to always use double quotes.
This commit is contained in:
parent
ea4c7245be
commit
c1a82a034b
49 changed files with 396 additions and 151 deletions
|
@ -89,3 +89,29 @@ class ExtComboBoxItems(AstNode):
|
|||
)
|
||||
def items_completer(lsp, ast_node, match_variables):
|
||||
yield Completion("items", CompletionItemKind.Snippet, snippet="items [$0]")
|
||||
|
||||
|
||||
@decompiler("items", parent_type="Gtk.ComboBoxText")
|
||||
def decompile_items(ctx: DecompileCtx, gir: gir.GirContext):
|
||||
ctx.print("items [")
|
||||
|
||||
|
||||
@decompiler("item", parent_type="Gtk.ComboBoxText", cdata=True)
|
||||
def decompile_item(
|
||||
ctx: DecompileCtx,
|
||||
gir: gir.GirContext,
|
||||
cdata: str,
|
||||
id: T.Optional[str] = None,
|
||||
translatable="false",
|
||||
comments=None,
|
||||
context=None,
|
||||
):
|
||||
comments, translatable = decompile_translatable(
|
||||
cdata, translatable, context, comments
|
||||
)
|
||||
if comments:
|
||||
ctx.print(comments)
|
||||
if id:
|
||||
ctx.print(f"{id}: ")
|
||||
ctx.print(translatable)
|
||||
ctx.print(",")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue