From 9806bbc67b8511f9395cff11772594e7218c357c Mon Sep 17 00:00:00 2001 From: ouczbs Date: Wed, 23 Oct 2024 20:51:29 +0800 Subject: [PATCH] bugfix --- src/refl/GenMetaImpl.cs | 3 ++- src/refl/template/meta_impl.liquid | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/refl/GenMetaImpl.cs b/src/refl/GenMetaImpl.cs index 64fce8f..2a148bb 100644 --- a/src/refl/GenMetaImpl.cs +++ b/src/refl/GenMetaImpl.cs @@ -28,7 +28,7 @@ namespace refl public int MetaType { get; set; } = 0; public int MemberCount { get; set; } = 0; public int CtorCount { get; set; } = 0; - + public int LastAttrIndex { get; set; } = 0; public List FieldList = new List(); } @@ -63,6 +63,7 @@ namespace refl { data.FieldList.Add(new FieldMetaImplData(field, 1)); } + data.LastAttrIndex = data.FieldList.Count; foreach (var field in pair.Value.CtorList) { data.FieldList.Add(new FieldMetaImplData(field, 2)); diff --git a/src/refl/template/meta_impl.liquid b/src/refl/template/meta_impl.liquid index 1577660..76c42dd 100644 --- a/src/refl/template/meta_impl.liquid +++ b/src/refl/template/meta_impl.liquid @@ -4,7 +4,7 @@ namespace gen{ consteval static int MemberCount() { return {{MemberCount}}; }; consteval static int CtorCount() { return {{CtorCount}}; }; consteval static auto Fields(){ - return std::make_tuple({% for field in FieldList %}FProperty(&T::{{field.Name}},"{{field.Name}}"){% unless forloop.last %}, {% endunless %}{% endfor %}); + return std::make_tuple({% for field in FieldList limit:LastAttrIndex%}{%- if field.Type == 1 %}FProperty(&T::{{field.Name}},"{{field.Name}}"){% unless forloop.last %}, {% endunless %}{%- endif %}{% endfor %}); } static auto MakeFields() { return std::array{