Commit a85db356 authored by Christoph Richter's avatar Christoph Richter
Browse files

ExecuteMethodGeneratorHandler: Fixed missing colvec initialization if dimesnsion is {n,1}

parent bb380749
Pipeline #63769 failed with stage
in 2 minutes and 11 seconds
......@@ -8,7 +8,6 @@ import de.monticore.lang.monticar.generator.Variable;
import de.monticore.lang.monticar.generator.cpp.MathCommandRegisterCPP;
import de.monticore.lang.monticar.generator.cpp.MathFunctionFixer;
import de.monticore.lang.monticar.generator.cpp.OctaveHelper;
import de.monticore.lang.monticar.generator.cpp.StringValueListExtractorUtil;
import de.monticore.lang.monticar.generator.cpp.symbols.MathChainedExpression;
import de.monticore.lang.monticar.generator.cpp.symbols.MathStringExpression;
import de.monticore.lang.monticar.types2._ast.ASTElementType;
......@@ -111,7 +110,7 @@ public class ExecuteMethodGeneratorHandler {
result = "=" + TypeConverter.getDimensionString(TypeConverter.getColvecAccessString(type), dims, includeStrings);
}
} else if (dims.size() == 2) {
if (typeString.equals(TypeConverter.getMatAccessString(type))) {
if (typeIsCompatible(typeString, type, dims)) {
result = "=" + TypeConverter.getDimensionString(TypeConverter.getMatAccessString(type), dims, includeStrings);
}
} else if (dims.size() == 3) {
......@@ -122,6 +121,14 @@ public class ExecuteMethodGeneratorHandler {
return result;
}
private static boolean typeIsCompatible(String typeString, ASTElementType type, List<MathExpressionSymbol> dims) {
boolean result = typeString.equals(TypeConverter.getMatAccessString(type));
if (!result && (dims.size() == 2) && (dims.get(1).getTextualRepresentation().contentEquals("1"))) {
result = typeString.contentEquals("colvec") && TypeConverter.getMatAccessString(type).contentEquals("mat");
}
return result;
}
public static String generateExecuteCode(MathValueSymbol mathValueSymbol, List<String> includeStrings) {
String result = "";
String type = generateExecuteCode(mathValueSymbol.getType(), includeStrings);
......
Supports Markdown
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