From 7fe3265146017ea9ebf80ebdf7372bb38a65e1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 1 Feb 2024 20:28:56 +0100 Subject: [PATCH] some progress? --- src/Serialization/Upgrades/0.15.0.jl | 35 +++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Serialization/Upgrades/0.15.0.jl b/src/Serialization/Upgrades/0.15.0.jl index 6ead1bb57d0e..f41714210814 100644 --- a/src/Serialization/Upgrades/0.15.0.jl +++ b/src/Serialization/Upgrades/0.15.0.jl @@ -6,7 +6,7 @@ push!(upgrade_scripts_set, UpgradeScript( v"0.15.0", function upgrade_0_15_0(s::UpgradeState, dict::Dict) - upgraded_dict = dict + upgraded_dict = dict #upgrade_data(upgrade_0_15_0, s, dict) renamings = Dict{String,String}([ ("FlintPadicField", "PadicField"), @@ -31,18 +31,31 @@ push!(upgrade_scripts_set, UpgradeScript( ("EmbeddedElem", "EmbeddedNumFieldElem"), ]) - if haskey(dict, :_type) && dict[:_type] isa String && haskey(renamings, dict[:_type]) - upgraded_dict[:_type] = renamings[dict[:_type]] + function upgrade_type(d::String) + println(d) + return get(renamings, d, d) end - if haskey(dict, :_type) && - dict[:_type] isa Dict && - haskey(dict[:_type], :name) && - dict[:_type][:name] isa String && - haskey(renamings, dict[:_type][:name]) - upgraded_dict[:_type][:name] = renamings[dict[:_type][:name]] + function upgrade_type(d::Dict) + println(d) + upg_d = d + upg_d[:name] = get(renamings, d[:name], d[:name]) + if d[:params] isa Dict && haskey(d[:params], :_type) + upg_d[:params][:_type] = upgrade_type(d[:params][:_type]) + end + return upg_d + end + + if haskey(dict, :_type) + upgraded_dict[:_type] = upgrade_type(dict[:_type]) end - - # handle data upgrade (recurse on sub tree) + + # # handle data upgrade (recurse on sub tree) + # for (k, v) in dict + # k == :_type && continue + # if v isa Dict + # upgraded_dict[k] = upgrade_0_15_0(s, v) + # elseif v isa + if haskey(dict, :data) && dict[:data] isa Dict upgraded_dict[:data] = upgrade_0_15_0(s, dict[:data]) end