Commit 2d34d68c authored by Gergo Ujhelyi's avatar Gergo Ujhelyi
Browse files

added new code generator to template arrays


Signed-off-by: Gergo Ujhelyi's avatarGergoUjhelyi <ujhelyi.gergo@ericsson.com>
parent e958b1a3
......@@ -50,6 +50,7 @@ import org.eclipse.titan.designer.productUtilities.ProductConstants;
*
* @author Kristof Szabados
* @author Arpad Lovassy
* @author Gergo Ujhelyi
*/
public final class Def_Var_Template extends Definition {
private static final String FULLNAMEPART1 = ".<type>";
......@@ -525,10 +526,8 @@ public final class Def_Var_Template extends Definition {
final String typeGeneratedName = type.getGenNameTemplate( aData, source, getMyScope() );
if (type.getTypetype().equals(Type_type.TYPE_ARRAY)) {
Array_Type arrayType = (Array_Type) type;
String elementType = arrayType.getElementType().getGenNameValue(aData, source, myScope);
source.append(MessageFormat.format("{0} {1} = new {0}({2}.class, {2}_template.class);\n", typeGeneratedName, genName, elementType));
source.append(MessageFormat.format("{0}.setSize({1});\n",genName,(int)arrayType.getDimension().getSize()));
source.append(MessageFormat.format("{0}.setOffset({1});\n",genName,(int)arrayType.getDimension().getOffset()));
StringBuilder sb = aData.getCodeForType(arrayType.getGenNameOwn());
source.append(MessageFormat.format("{0} {1} = new {0}();\n",arrayType.generateCodeTemplate(aData, source, arrayType, sb), genName));
} else {
source.append(MessageFormat.format("{0} {1} = new {0}();\n", typeGeneratedName, genName));
}
......
......@@ -1268,16 +1268,10 @@ public abstract class TTCN3Template extends GovernedSimple implements IReference
}
public void generateCodeInitSeofElement(final JavaGenData aData, final StringBuilder source, final String name, final String index, final String elementTypeGenname) {
if (needsTemporaryReference()) {
String tempId = aData.getTemporaryVariableName();
source.append("{\n");
source.append(MessageFormat.format("{0} {1} = {2}.getAt({3});\n", elementTypeGenname, tempId, name, index));
generateCodeInit(aData, source, tempId);
source.append("}\n");
} else {
String embeddedName = MessageFormat.format("{0}.getAt({1})", name, index);
generateCodeInit(aData, source, embeddedName);
}
source.append("}\n");
}
/**
......
......@@ -651,7 +651,7 @@ public final class Template_List extends CompositeTemplate {
source.append(");\n");
source.append(body);
} else {
source.append(MessageFormat.format("{0}.setSize({1});\n", name, getNofTemplates()));
//source.append(MessageFormat.format("{0}.setSize({1});\n", name, getNofTemplates()));
int index = 0;
for (int i = 0, size = templates.getNofTemplates(); i < size; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment