diff --git a/KotlinServer/Class.java.twig b/KotlinServer/Class.java.twig index 668e9d0..84e3903 100644 --- a/KotlinServer/Class.java.twig +++ b/KotlinServer/Class.java.twig @@ -13,5 +13,6 @@ import org.joda.time.DateTime //TODO update */ {%- endif %} open class {% include 'blocks/class/classtype.twig' with { type: type } %} ( - {%- include 'blocks/class/constructor-fields.twig' with { fields: fields, superclassesFields: superclassesFields } %} + {%- include 'blocks/class/constructor-fields-info.twig' with { fields: superclassesFields, includeVal: false, addCommaAtTheEnd: (fields is not empty) } %} + {%- include 'blocks/class/constructor-fields-info.twig' with { fields: fields, includeVal: true, addComma: false } %} ) : {% include 'blocks/class/supertype.twig' with { type: type, parent: parent } %} ({%- include 'blocks/class/fields-super-initialization.twig' with { fields: superclassesFields } -%}) \ No newline at end of file diff --git a/KotlinServer/blocks/class/constructor-fields-info.twig b/KotlinServer/blocks/class/constructor-fields-info.twig index c389f63..38248ff 100644 --- a/KotlinServer/blocks/class/constructor-fields-info.twig +++ b/KotlinServer/blocks/class/constructor-fields-info.twig @@ -1,3 +1,8 @@ {%- import '../../utils.twig' as utils -%} -{%- if includeVal %} val {% endif %} {{ field.name }}: {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} \ No newline at end of file +{%- for field in fields %} + {%- if includeVal %} + val + {%- else %} + {% endif %} {{ field.name }}: {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} {%- if (not (loop.last)) or (addCommaAtTheEnd)%}, {% endif %} +{%- endfor -%} \ No newline at end of file diff --git a/KotlinServer/blocks/class/constructor-fields.twig b/KotlinServer/blocks/class/constructor-fields.twig deleted file mode 100644 index d21b09c..0000000 --- a/KotlinServer/blocks/class/constructor-fields.twig +++ /dev/null @@ -1,8 +0,0 @@ -{%- import '../../utils.twig' as utils -%} - -{%- for field in superclassesFields %} - {{ field.name }}{{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {%- if (not (loop.last)) or (fields is not empty)%}, {% endif %} -{%- endfor -%} -{%- for field in fields %} - {{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} val {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {{ field.name }} {%- if not (loop.last) %}, {% endif %} -{%- endfor -%}