[fix] 修复为cs_unity_json生成 反序列化external bean类型的编译错误bug

main
walon 2022-08-10 20:22:04 +08:00
parent ff6e09ec9d
commit 69a0acf63e
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,7 @@
using Luban.Job.Cfg.Datas;
using Luban.Job.Common.Types;
using Luban.Job.Common.TypeVisitors;
using Luban.Job.Common.Utils;
using System;
namespace Luban.Job.Cfg.TypeVisitors
@ -80,7 +81,8 @@ namespace Luban.Job.Cfg.TypeVisitors
public string Accept(TBean type, string json, string x, int depth)
{
return $"{x} = {type.CsUnderingDefineType()}.Deserialize{type.Bean.Name}({json});";
string src = $"{type.Bean.FullName}.Deserialize{type.Bean.Name}({json});";
return $"{x} = {ExternalTypeUtil.CsCloneToExternal(type.Bean.FullName, src)};";
}
public string Accept(TArray type, string json, string x, int depth)

View File

@ -1,6 +1,7 @@
using Luban.Job.Cfg.Datas;
using Luban.Job.Common.Types;
using Luban.Job.Common.TypeVisitors;
using Luban.Job.Common.Utils;
using System;
namespace Luban.Job.Cfg.TypeVisitors
@ -81,7 +82,8 @@ namespace Luban.Job.Cfg.TypeVisitors
public string Accept(TBean type, string json, string x, int depth)
{
return $"{{ if(!{json}.IsObject) {{ throw new SerializationException(); }} {x} = {type.CsUnderingDefineType()}.Deserialize{type.Bean.Name}({json}); }}";
string src = $"{type.Bean.FullName}.Deserialize{type.Bean.Name}({json})";
return $"{{ if(!{json}.IsObject) {{ throw new SerializationException(); }} {x} = {ExternalTypeUtil.CsCloneToExternal(type.Bean.FullName, src)}; }}";
}
public string Accept(TArray type, string json, string x, int depth)