Mercurial > hg > orthanc-stone
diff Resources/CodeGeneration/template.in.ts @ 507:ce49eae4c887 bgo-commands-codegen
Codegen + Warning fixes
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 01 Mar 2019 16:18:38 +0100 |
parents | 6405435480ae |
children | 7105a0bad250 |
line wrap: on
line diff
--- a/Resources/CodeGeneration/template.in.ts Tue Feb 26 21:33:16 2019 +0100 +++ b/Resources/CodeGeneration/template.in.ts Fri Mar 01 16:18:38 2019 +0100 @@ -1,6 +1,9 @@ /* 1 2 3 4 5 6 7 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + +Generated on {{currentDatetime}} by stonegentool + */ function StoneCheckSerializedValueType(value: any, typeStr: string) @@ -42,11 +45,24 @@ {%endfor%} {% for struct in structs%} export class {{struct['name']}} { -{% for key in struct['fields']%} {{key}}:{{CanonToTs(struct['fields'][key])}}; -{% endfor %} + {% if struct %} + {% if struct['fields'] %} + {% for key in struct['fields']%} + {{key}}:{{CanonToTs(struct['fields'][key])}}; + {% endfor %} + {% endif %} + {% endif %} constructor() { -{% for key in struct['fields']%}{% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %} this.{{key}} = new {{CanonToTs(struct['fields'][key])}}(); -{% endif %}{% endfor %} } + {% if struct %} + {% if struct['fields'] %} + {% for key in struct['fields']%} + {% if NeedsTsConstruction(enums,CanonToTs(struct['fields'][key])) %} + this.{{key}} = new {{CanonToTs(struct['fields'][key])}}(); + {% endif %} + {% endfor %} + {% endif %} + {% endif %} +} public StoneSerialize(): string { let container: object = {};