From eb34a4cb7f3f19cf43e63b2673b6a88e3ef00f95 Mon Sep 17 00:00:00 2001 From: walon Date: Thu, 28 Oct 2021 17:00:27 +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=8D=E6=B2=A1=E6=9C=89=E6=A3=80=E6=9F=A5=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E4=B8=ADbean=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=AD=90=E6=95=B0=E6=8D=AE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/DataVisitors/ValidatorVisitor.cs | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Luban.Job.Cfg/Source/DataVisitors/ValidatorVisitor.cs b/src/Luban.Job.Cfg/Source/DataVisitors/ValidatorVisitor.cs index 1ad671b..2b2a38f 100644 --- a/src/Luban.Job.Cfg/Source/DataVisitors/ValidatorVisitor.cs +++ b/src/Luban.Job.Cfg/Source/DataVisitors/ValidatorVisitor.cs @@ -75,6 +75,20 @@ namespace Luban.Job.Cfg.DataVisitors _path.Pop(); } } + + if (elementType is TBean) + { + int index = 0; + foreach (var value in eles) + { + _path.Push(index++); + if (value != null) + { + elementType.Apply(this, value); + } + _path.Pop(); + } + } } public void Accept(TBool type, DType x) @@ -219,13 +233,28 @@ namespace Luban.Job.Cfg.DataVisitors if (v is IValidator eleVal) { eleVal.Validate(Ctx, valueType, e.Value); - valueType.Apply(this, e.Value); + if (e.Value != null) + { + valueType.Apply(this, e.Value); + } } } } _path.Pop(); } } + if (valueType is TBean) + { + foreach (var e in ((DMap)x).Datas) + { + _path.Push(e.Key); + if (e.Value != null) + { + valueType.Apply(this, e.Value); + } + _path.Pop(); + } + } } public void Accept(TVector2 type, DType x)