Skip to content

Commit 726c4e2

Browse files
committed
Some simplifications
1 parent 9bfb5c2 commit 726c4e2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/simple_varinfo.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,7 @@ end
234234
function SimpleVarInfo{T}(
235235
rng::Random.AbstractRNG, model::Model, init_strategy::AbstractInitStrategy=PriorInit()
236236
) where {T<:Real}
237-
new_context = setleafcontext(model.context, InitContext(rng, init_strategy))
238-
new_model = contextualize(model, new_context)
239-
return last(evaluate!!(new_model, SimpleVarInfo{T}()))
237+
return last(init!!(rng, model, SimpleVarInfo{T}(), init_strategy))
240238
end
241239
function SimpleVarInfo{T}(
242240
model::Model, init_strategy::AbstractInitStrategy=PriorInit()
@@ -491,8 +489,9 @@ function settrans!!(vi::ThreadSafeVarInfo{<:SimpleVarInfo}, trans)
491489
return Accessors.@set vi.varinfo = settrans!!(vi.varinfo, trans)
492490
end
493491
function settrans!!(vi::SimpleOrThreadSafeSimple, trans::Bool, ::VarName)
494-
# We keep this method around just to obey the AbstractVarInfo interface; however,
495-
# this is only a valid operation if it would be a no-op.
492+
# We keep this method around just to obey the AbstractVarInfo interface.
493+
# However, note that this would only be a valid operation if it would be a
494+
# no-op, which we check here.
496495
if trans != istrans(vi)
497496
error(
498497
"Individual variables in SimpleVarInfo cannot have different `settrans` statuses.",

0 commit comments

Comments
 (0)