From c009d54d26728ba4758880eae4d8fce894cf45dd Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 3 Jan 2022 12:51:46 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dref=E5=8F=AA=E5=8C=85=E5=90=AB=E4=B8=80=E4=B8=AArefgro?= =?UTF-8?q?up=EF=BC=8C=E5=90=8C=E6=97=B6refgroup=E5=8F=AA=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E4=B8=80=E4=B8=AA=E8=A1=A8=E6=97=B6=EF=BC=8C=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=88=A4=E5=AE=9A=E4=B8=BA=E9=9C=80=E8=A6=81genRef?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=87=BA=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Luban.Job.Cfg/Source/Validators/RefValidator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs b/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs index 463476c..f61c070 100644 --- a/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs +++ b/src/Luban.Job.Cfg/Source/Validators/RefValidator.cs @@ -127,6 +127,7 @@ namespace Luban.Job.Cfg.Validators } var assembly = ((DefField)def).Assembly; + bool anyRefGroup = false; foreach (var table in Tables) { var (actualTable, indexName, ignoreDefault) = ParseRefString(table); @@ -152,13 +153,14 @@ namespace Luban.Job.Cfg.Validators } CompileTable(def, subTable, refIndex, ignoreDefault && refIgnoreDefault); } + anyRefGroup = true; } else { throw new Exception($"结构:'{hostTypeName}' 字段:'{fieldName}' ref:'{actualTable}' 不存在"); } } - if (_compiledTables.Count == 1 && (_compiledTables[0].Table is DefTable t && t.IsMapTable && t.NeedExport)) + if (!anyRefGroup && _compiledTables.Count == 1 && (_compiledTables[0].Table is DefTable t && t.IsMapTable && t.NeedExport)) { // 只引用一个表时才生成ref代码。 // 如果被引用的表没有导出,生成ref没有意义,还会产生编译错误