Commit 37a70d2a authored by Christoph Richter's avatar Christoph Richter
Browse files

fixup! Fixed wrong constant declaration for variable matrices (fixes #18)

parent 2c6454b8
Pipeline #65079 failed with stage
in 15 seconds
package de.monticore.lang.monticar.generator.cpp.converter; package de.monticore.lang.monticar.generator.cpp.converter;
import de.monticore.lang.math._symboltable.expression.IArithmeticExpression; import de.monticore.lang.math._symboltable.expression.IArithmeticExpression;
import de.monticore.lang.math._symboltable.expression.MathArithmeticExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol; import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol; import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.math._symboltable.matrix.*; import de.monticore.lang.math._symboltable.matrix.*;
...@@ -300,12 +301,20 @@ public class ExecuteMethodGeneratorMatrixExpressionHandler { ...@@ -300,12 +301,20 @@ public class ExecuteMethodGeneratorMatrixExpressionHandler {
MathExpressionSymbol elemSymbol = elem.getMathExpressionSymbol().get(); MathExpressionSymbol elemSymbol = elem.getMathExpressionSymbol().get();
if (elemSymbol instanceof MathNameExpressionSymbol || elemSymbol instanceof MathMatrixNameExpressionSymbol) if (elemSymbol instanceof MathNameExpressionSymbol || elemSymbol instanceof MathMatrixNameExpressionSymbol)
return true; return true;
else if (elemSymbol instanceof MathArithmeticExpressionSymbol) {
return arithmeticExpressionContainsVariables((MathArithmeticExpressionSymbol) elemSymbol);
}
} }
} }
} }
return false; return false;
} }
private static boolean arithmeticExpressionContainsVariables(MathArithmeticExpressionSymbol symbol) {
return (symbol.getLeftExpression() instanceof MathNameExpressionSymbol) || (symbol.getLeftExpression() instanceof MathMatrixNameExpressionSymbol)
|| (symbol.getLeftExpression() instanceof MathNameExpressionSymbol) || (symbol.getLeftExpression() instanceof MathMatrixNameExpressionSymbol);
}
public static String generateExecuteCode(MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol, List<String> includeStrings) { public static String generateExecuteCode(MathMatrixNameExpressionSymbol mathMatrixNameExpressionSymbol, List<String> includeStrings) {
String result = ""; String result = "";
//TODO fix matrix access parameter stuff //TODO fix matrix access parameter stuff
......
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