mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-21 23:19:24 -04:00
Fix incorrect error with Adw.AlertDialog responses
This commit is contained in:
parent
2e42dc6848
commit
5c7fb03da7
3 changed files with 33 additions and 4 deletions
|
@ -60,19 +60,21 @@ class ScopeCtx:
|
|||
|
||||
passed = {}
|
||||
for obj in self._iter_recursive(self.node):
|
||||
if obj.tokens["id"] is None:
|
||||
from .gtk_menu import Menu
|
||||
|
||||
if not (isinstance(obj, Object) or isinstance(obj, Menu)) or obj.id is None:
|
||||
continue
|
||||
|
||||
if obj.tokens["id"] in passed:
|
||||
if obj.id in passed:
|
||||
token = obj.group.tokens["id"]
|
||||
if not isinstance(obj, Template) and not isinstance(
|
||||
obj, ExtListItemFactory
|
||||
):
|
||||
raise CompileError(
|
||||
f"Duplicate object ID '{obj.tokens['id']}'",
|
||||
f"Duplicate object ID '{obj.id}'",
|
||||
token.range,
|
||||
)
|
||||
passed[obj.tokens["id"]] = obj
|
||||
passed[obj.id] = obj
|
||||
|
||||
def _iter_recursive(self, node: AstNode):
|
||||
yield node
|
||||
|
|
11
tests/samples/issue_195.blp
Normal file
11
tests/samples/issue_195.blp
Normal file
|
@ -0,0 +1,11 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
Adw.AlertDialog dialog1 {
|
||||
responses [
|
||||
ok: "Ok",
|
||||
cancel: "Cancel",
|
||||
]
|
||||
}
|
||||
|
||||
Button cancel {}
|
16
tests/samples/issue_195.ui
Normal file
16
tests/samples/issue_195.ui
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
DO NOT EDIT!
|
||||
This file was @generated by blueprint-compiler. Instead, edit the
|
||||
corresponding .blp file and regenerate this file with blueprint-compiler.
|
||||
-->
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="AdwAlertDialog" id="dialog1">
|
||||
<responses>
|
||||
<response id="ok">Ok</response>
|
||||
<response id="cancel">Cancel</response>
|
||||
</responses>
|
||||
</object>
|
||||
<object class="GtkButton" id="cancel"></object>
|
||||
</interface>
|
Loading…
Add table
Add a link
Reference in a new issue