Commit a67c9a3c authored by Gergo Ujhelyi's avatar Gergo Ujhelyi
Browse files

new code generator for const arrays.


Signed-off-by: Gergo Ujhelyi's avatarGergoUjhelyi <ujhelyi.gergo@ericsson.com>
parent eb266eb7
......@@ -493,8 +493,13 @@ public final class Def_Const extends Definition {
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(" static final {0} {1} = new {0}({2}.class);\n", typeGeneratedName, genName, elementType));
if(arrayType.getElementType().getTypetype() == Type_type.TYPE_ARRAY) {
StringBuilder temp_sb = aData.getCodeForType(arrayType.getGenNameOwn());
source.append(MessageFormat.format(" static final {0} {1} = new {0}();\n", arrayType.generateCodeValue(aData, source,arrayType,temp_sb),genName));
} else {
String elementType = arrayType.getElementType().getGenNameValue(aData, source, myScope);
source.append(MessageFormat.format(" static final {0} {1} = new {0}({2}.class, {3} , {4});\n", typeGeneratedName, genName, elementType, arrayType.getDimension().getSize(), arrayType.getDimension().getOffset()));
}
}
else {
source.append(MessageFormat.format(" static final {0} {1} = new {0}();\n", typeGeneratedName, genName));
......@@ -525,8 +530,13 @@ public final class Def_Const extends Definition {
} else {
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);\n", typeGeneratedName, genName, elementType));
if(arrayType.getElementType().getTypetype() == Type_type.TYPE_ARRAY) {
StringBuilder sb = aData.getCodeForType(arrayType.getGenNameOwn());
source.append(MessageFormat.format("{0} {1} = new {0}();\n", arrayType.generateCodeValue(aData, source,arrayType,sb),genName));
} else {
String elementType = arrayType.getElementType().getGenNameValue(aData, source, myScope);
source.append(MessageFormat.format("{0} {1} = new {0}({2}.class, {3} , {4});\n", typeGeneratedName, genName, elementType, arrayType.getDimension().getSize(), arrayType.getDimension().getOffset()));
}
}
else {
source.append(MessageFormat.format("{0} {1} = new {0}();\n", typeGeneratedName, genName));
......
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