mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix 'template' keyword in list item factories
This commit is contained in:
parent
5a782c653b
commit
46e467bbfb
7 changed files with 30 additions and 13 deletions
|
@ -36,6 +36,16 @@ class ValueTypeCtx:
|
|||
class ScopeCtx:
|
||||
node: AstNode
|
||||
|
||||
@cached_property
|
||||
def template(self):
|
||||
from .ui import UI
|
||||
from .gtk_list_item_factory import ExtListItemFactory
|
||||
|
||||
if isinstance(self.node, UI):
|
||||
return self.node.template
|
||||
elif isinstance(self.node, ExtListItemFactory):
|
||||
return self.node
|
||||
|
||||
@cached_property
|
||||
def objects(self) -> T.Dict[str, Object]:
|
||||
return {
|
||||
|
@ -45,6 +55,8 @@ class ScopeCtx:
|
|||
}
|
||||
|
||||
def validate_unique_ids(self) -> None:
|
||||
from .gtk_list_item_factory import ExtListItemFactory
|
||||
|
||||
passed = {}
|
||||
for obj in self._iter_recursive(self.node):
|
||||
if obj.tokens["id"] is None:
|
||||
|
@ -52,7 +64,9 @@ class ScopeCtx:
|
|||
|
||||
if obj.tokens["id"] in passed:
|
||||
token = obj.group.tokens["id"]
|
||||
if not isinstance(obj, Template):
|
||||
if not isinstance(obj, Template) and not isinstance(
|
||||
obj, ExtListItemFactory
|
||||
):
|
||||
raise CompileError(
|
||||
f"Duplicate object ID '{obj.tokens['id']}'",
|
||||
token.start,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue