@@ -89,35 +89,19 @@ isassumption(expr) = :(false)
8989 contextual_isassumption(context, vn)
9090
9191Return `true` if `vn` is considered an assumption by `context`.
92-
93- The default implementation for `AbstractContext` always returns `true`.
9492"""
95- contextual_isassumption (:: IsLeaf , context, vn) = true
96- function contextual_isassumption (:: IsParent , context, vn)
97- return contextual_isassumption (childcontext (context), vn)
98- end
9993function contextual_isassumption (context:: AbstractContext , vn)
100- return contextual_isassumption (NodeTrait (context), context, vn)
101- end
102- function contextual_isassumption (context:: ConditionContext , vn)
103- if hasconditioned (context, vn)
104- val = getconditioned (context, vn)
94+ if hasconditioned_nested (context, vn)
95+ val = getconditioned_nested (context, vn)
10596 # TODO : Do we even need the `>: Missing`, i.e. does it even help the compiler?
10697 if eltype (val) >: Missing && val === missing
10798 return true
10899 else
109100 return false
110101 end
102+ else
103+ return true
111104 end
112-
113- # We might have nested contexts, e.g. `ConditionContext{.., <:PrefixContext{..., <:ConditionContext}}`
114- # so we defer to `childcontext` if we haven't concluded that anything yet.
115- return contextual_isassumption (childcontext (context), vn)
116- end
117- function contextual_isassumption (context:: PrefixContext{Prefix} , vn) where {Prefix}
118- return contextual_isassumption (
119- prefix_conditioned_variables (childcontext (context), VarName {Prefix} ()), vn
120- )
121105end
122106
123107isfixed (expr, vn) = false
@@ -128,30 +112,18 @@ isfixed(::Union{Symbol,Expr}, vn) = :($(DynamicPPL.contextual_isfixed)(__context
128112
129113Return `true` if `vn` is considered fixed by `context`.
130114"""
131- contextual_isfixed (:: IsLeaf , context, vn) = false
132- function contextual_isfixed (:: IsParent , context, vn)
133- return contextual_isfixed (childcontext (context), vn)
134- end
135115function contextual_isfixed (context:: AbstractContext , vn)
136- return contextual_isfixed (NodeTrait (context), context, vn)
137- end
138- function contextual_isfixed (context:: PrefixContext , vn)
139- return contextual_isfixed (childcontext (context), prefix (context, vn))
140- end
141- function contextual_isfixed (context:: FixedContext , vn)
142- if hasfixed (context, vn)
143- val = getfixed (context, vn)
116+ if hasfixed_nested (context, vn)
117+ val = getfixed_nested (context, vn)
144118 # TODO : Do we even need the `>: Missing`, i.e. does it even help the compiler?
145119 if eltype (val) >: Missing && val === missing
146120 return false
147121 else
148122 return true
149123 end
124+ else
125+ return false
150126 end
151-
152- # We might have nested contexts, e.g. `FixedContext{.., <:PrefixContext{..., <:FixedContext}}`
153- # so we defer to `childcontext` if we haven't concluded that anything yet.
154- return contextual_isfixed (childcontext (context), vn)
155127end
156128
157129# If we're working with, say, a `Symbol`, then we're not going to `view`.
0 commit comments