Skip to content

Commit 0d9057b

Browse files
committed
no NodeTrait
1 parent dfa6915 commit 0d9057b

File tree

1 file changed

+3
-10
lines changed
  • developers/contexts/submodel-condition

1 file changed

+3
-10
lines changed

developers/contexts/submodel-condition/index.qmd

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,11 @@ We should like `myprefix(big_ctx, @varname(x))` to return `@varname(a.b.x)`.
265265
Consider the following naive implementation, which mirrors a lot of code in the tilde-pipeline:
266266

267267
```{julia}
268-
using DynamicPPL: NodeTrait, IsLeaf, IsParent, childcontext, AbstractContext
268+
using DynamicPPL: childcontext, AbstractContext, AbstractParentContext
269269
using AbstractPPL: AbstractPPL
270270
271-
function myprefix(ctx::DynamicPPL.AbstractContext, vn::VarName)
272-
return myprefix(NodeTrait(ctx), ctx, vn)
273-
end
274-
function myprefix(::IsLeaf, ::AbstractContext, vn::VarName)
275-
return vn
276-
end
277-
function myprefix(::IsParent, ctx::AbstractContext, vn::VarName)
278-
return myprefix(childcontext(ctx), vn)
279-
end
271+
myprefix(::AbstractContext, vn::VarName) = vn
272+
myprefix(ctx::AbstractParentContext, vn::VarName) = myprefix(childcontext(ctx), vn)
280273
function myprefix(ctx::DynamicPPL.PrefixContext, vn::VarName)
281274
# The functionality to actually manipulate the VarNames is in AbstractPPL
282275
new_vn = AbstractPPL.prefix(vn, ctx.vn_prefix)

0 commit comments

Comments
 (0)