Make builder template factories use a subscope

This commit is contained in:
James Westman 2023-04-28 20:42:46 -05:00
parent a2eaaa26fe
commit 9dcd06de51
6 changed files with 46 additions and 0 deletions

View file

@ -1,6 +1,8 @@
from .gobject_object import ObjectContent, validate_parent_type
from ..parse_tree import Keyword
from ..ast_utils import AstNode, validate
from .common import *
from .contexts import ScopeCtx
class ListItemFactory(AstNode):
@ -19,6 +21,14 @@ class ListItemFactory(AstNode):
"sub-templates",
)
@context(ScopeCtx)
def scope_ctx(self) -> ScopeCtx:
return ScopeCtx(node=self)
@validate()
def unique_ids(self):
self.context[ScopeCtx].validate_unique_ids()
@property
def content(self) -> ObjectContent:
return self.children[ObjectContent][0]