Change template syntax

Templates now use a TypeName instead of an identifier, which makes it
clearer that it's an extern symbol (or that it's a Gtk.ListItem).
This commit is contained in:
James Westman 2023-05-09 19:42:33 -05:00
parent aebf8be278
commit 04509e4b2e
31 changed files with 175 additions and 55 deletions

View file

@ -23,6 +23,7 @@ from functools import cached_property
from .common import *
from .gobject_object import Object
from .gtkbuilder_template import Template
@dataclass
@ -51,9 +52,12 @@ class ScopeCtx:
if obj.tokens["id"] in passed:
token = obj.group.tokens["id"]
raise CompileError(
f"Duplicate object ID '{obj.tokens['id']}'", token.start, token.end
)
if not isinstance(obj, Template):
raise CompileError(
f"Duplicate object ID '{obj.tokens['id']}'",
token.start,
token.end,
)
passed[obj.tokens["id"]] = obj
def _iter_recursive(self, node: AstNode):