Add ScopeCtx instead of root.objects_by_id

This allows us to introduce new scopes, such as in
GtkBuilderListItemFactory templates.
This commit is contained in:
James Westman 2023-04-28 20:16:27 -05:00
parent ff5fff7f4b
commit ec844b10ca
8 changed files with 65 additions and 40 deletions

View file

@ -20,6 +20,7 @@
import typing as T
from .gtkbuilder_template import Template
from .contexts import ScopeCtx
from .common import *
@ -112,7 +113,7 @@ class Signal(AstNode):
if object_id is None:
return
if self.root.objects_by_id.get(object_id) is None:
if self.context[ScopeCtx].objects.get(object_id) is None:
raise CompileError(f"Could not find object with ID '{object_id}'")
@docs("name")