mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
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:
parent
ff5fff7f4b
commit
ec844b10ca
8 changed files with 65 additions and 40 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
from .common import *
|
||||
from .contexts import ValueTypeCtx
|
||||
from .contexts import ScopeCtx, ValueTypeCtx
|
||||
from .types import TypeName
|
||||
from .gtkbuilder_template import Template
|
||||
|
||||
|
@ -87,7 +87,7 @@ class LiteralExpr(Expr):
|
|||
|
||||
return (
|
||||
isinstance(self.literal.value, IdentLiteral)
|
||||
and self.literal.value.ident in self.root.objects_by_id
|
||||
and self.literal.value.ident in self.context[ScopeCtx].objects
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -105,7 +105,7 @@ class LiteralExpr(Expr):
|
|||
from .values import IdentLiteral
|
||||
|
||||
if isinstance(self.literal.value, IdentLiteral):
|
||||
if object := self.root.objects_by_id.get(self.literal.value.ident):
|
||||
if object := self.context[ScopeCtx].objects.get(self.literal.value.ident):
|
||||
return not isinstance(object, Template)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue