From 4d2bd5f356772bc877690c8e9061dd5996aaf712 Mon Sep 17 00:00:00 2001 From: wrenge Date: Thu, 9 Nov 2023 10:42:37 +0300 Subject: [PATCH] Fix split. Implement @cs_embed --- src/codegen.inc.php | 1 + tpl/macro.twig | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/codegen.inc.php b/src/codegen.inc.php index ebd715c..5a02b0a 100644 --- a/src/codegen.inc.php +++ b/src/codegen.inc.php @@ -31,6 +31,7 @@ function supported_tokens() 'diffable', 'table_pkey', 'bhl_bind', + 'cs_embed', 'cs_implements', 'cs_attributes', 'cs_accessor_interface', diff --git a/tpl/macro.twig b/tpl/macro.twig index 6bfeecc..ed72a3f 100644 --- a/tpl/macro.twig +++ b/tpl/macro.twig @@ -31,6 +31,8 @@ {{_self.attributes(o)}} public {{_self.struct_type(o)}} {{o.name}} {{_self.base_struct_class(o)}} { + {{token(o, 'cs_embed', '')}} + {{_self.decl_struct_fields(o)}} public {{o.parent ? 'new'}} const uint STATIC_CLASS_ID = {{o.classid}}; @@ -204,9 +206,11 @@ ResetFieldMask(); : {{o.parent ? o.parent.name : 'BaseMetaStruct'}} {{- has_token(o, 'cloneable') and not o.parent ? ', IMetaCloneable' -}} {%- endif -%} -{%- for ifs in token(o, "cs_implements", "")|split(',') -%} +{%- if has_token(o, "cs_implements") -%} +{%- for ifs in token(o, "cs_implements")|split(',') -%} , {{ifs}} {%- endfor -%} +{%- endif -%} {%- for ai in get_accessor_interfaces(o) -%} , {{ai.interfacename}}