diff --git a/blueprintcompiler/language/contexts.py b/blueprintcompiler/language/contexts.py index 9376211..6e26048 100644 --- a/blueprintcompiler/language/contexts.py +++ b/blueprintcompiler/language/contexts.py @@ -60,21 +60,19 @@ class ScopeCtx: passed = {} for obj in self._iter_recursive(self.node): - from .gtk_menu import Menu - - if not (isinstance(obj, Object) or isinstance(obj, Menu)) or obj.id is None: + if obj.tokens["id"] is None: continue - if obj.id in passed: + if obj.tokens["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.id}'", + f"Duplicate object ID '{obj.tokens['id']}'", token.range, ) - passed[obj.id] = obj + passed[obj.tokens["id"]] = obj def _iter_recursive(self, node: AstNode): yield node diff --git a/tests/samples/issue_195.blp b/tests/samples/issue_195.blp deleted file mode 100644 index 50b5b95..0000000 --- a/tests/samples/issue_195.blp +++ /dev/null @@ -1,11 +0,0 @@ -using Gtk 4.0; -using Adw 1; - -Adw.AlertDialog dialog1 { - responses [ - ok: "Ok", - cancel: "Cancel", - ] -} - -Button cancel {} diff --git a/tests/samples/issue_195.ui b/tests/samples/issue_195.ui deleted file mode 100644 index b57a379..0000000 --- a/tests/samples/issue_195.ui +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Ok - Cancel - - - - \ No newline at end of file