@@ -363,6 +363,19 @@ function stdlibs()
363363end
364364is_stdlib (uuid:: UUID ) = uuid in keys (stdlibs ())
365365
366+ # Find the entry in `STDLIBS_BY_VERSION`
367+ # that corresponds to the requested version, and use that.
368+ function get_last_stdlibs (julia_version:: VersionNumber )
369+ last_stdlibs = Dict {UUID,String} ()
370+ for (version, stdlibs) in STDLIBS_BY_VERSION
371+ if VersionNumber (julia_version. major, julia_version. minor, julia_version. patch) < version
372+ break
373+ end
374+ last_stdlibs = stdlibs
375+ end
376+ return last_stdlibs
377+ end
378+
366379# Allow asking if something is an stdlib for a particular version of Julia
367380function is_stdlib (uuid:: UUID , julia_version:: Union{VersionNumber, Nothing} )
368381 # Only use the cache if we are asking for stdlibs in a custom Julia version
@@ -381,16 +394,7 @@ function is_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
381394 return false
382395 end
383396
384- # If we are given an actual version, find the entry in `STDLIBS_BY_VERSION`
385- # that corresponds to the requested version, and use that.
386- last_stdlibs = Dict {UUID,String} ()
387- for (version, stdlibs) in STDLIBS_BY_VERSION
388- if VersionNumber (julia_version. major, julia_version. minor, julia_version. patch) < version
389- break
390- end
391- last_stdlibs = stdlibs
392- end
393-
397+ last_stdlibs = get_last_stdlibs (julia_version)
394398 # Note that if the user asks for something like `julia_version = 0.7.0`, we'll
395399 # fall through with an empty `last_stdlibs`, which will always return `false`.
396400 return uuid in keys (last_stdlibs)
0 commit comments