diff --git a/src/Registry/registry_instance.jl b/src/Registry/registry_instance.jl index 36b8ce13d2..c5743fed4f 100644 --- a/src/Registry/registry_instance.jl +++ b/src/Registry/registry_instance.jl @@ -1,5 +1,6 @@ using Base: UUID, SHA1 using TOML +using Dates using Tar using ..Versions: VersionSpec, VersionRange @@ -15,10 +16,7 @@ function to_tar_path_format(file::AbstractString) end # See loading.jl -const TOML_CACHE = let parser = Base.TOML.Parser() - parser.Dates = Dates - Base.TOMLCache(parser, Dict{String, Dict{String, Any}}()) -end +const TOML_CACHE = Base.TOMLCache(Base.TOML.Parser{Dates}()) const TOML_LOCK = ReentrantLock() _parsefile(toml_file::AbstractString) = Base.parsed_toml(toml_file, TOML_CACHE, TOML_LOCK) function parsefile(in_memory_registry::Union{Dict, Nothing}, folder::AbstractString, file::AbstractString) @@ -26,8 +24,7 @@ function parsefile(in_memory_registry::Union{Dict, Nothing}, folder::AbstractStr return _parsefile(joinpath(folder, file)) else content = in_memory_registry[to_tar_path_format(file)] - parser = Base.TOML.Parser(content; filepath=file) - parser.Dates = Dates + parser = Base.TOML.Parser{Dates}(content; filepath=file) return Base.TOML.parse(parser) end end diff --git a/src/Types.jl b/src/Types.jl index d6b31710c3..6bbdca5ad5 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -53,10 +53,7 @@ function deepcopy_toml(x::Dict{String, Any}) end # See loading.jl -const TOML_CACHE = let parser = Base.TOML.Parser() - parser.Dates = Dates - Base.TOMLCache(parser, Dict{String, Dict{String, Any}}()) -end +const TOML_CACHE = Base.TOMLCache(Base.TOML.Parser{Dates}()) const TOML_LOCK = ReentrantLock() # Some functions mutate the returning Dict so return a copy of the cached value here parse_toml(toml_file::AbstractString) =