forked from JavaTX/JavaCompilerCore
modified: ../../src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java
Trennung von Integer und Double in private Expression convert(Java8Parser.LiteralContext literal) eingefuegt modified: ../../src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java Typisierung von Literals eingefuegt modified: ../../test/bytecode/javFiles/MatrixOP.jav Name Matrix durch MatrixOP ersetzt
This commit is contained in:
parent
b56f18c16e
commit
674233e2f9
@ -818,8 +818,12 @@ public class StatementGenerator {
|
||||
}
|
||||
|
||||
private Expression convert(Java8Parser.LiteralContext literal) {
|
||||
if(literal.IntegerLiteral() != null || literal.FloatingPointLiteral()!= null){
|
||||
Number value = Double.parseDouble(literal.IntegerLiteral().getText());
|
||||
if(literal.IntegerLiteral() != null){
|
||||
Number value = Integer.parseInt(literal.IntegerLiteral().getText());
|
||||
return new Literal(TypePlaceholder.fresh(literal.getStart()),
|
||||
value, literal.getStart());
|
||||
} else if(literal.FloatingPointLiteral()!= null){
|
||||
Number value = Double.parseDouble(literal.FloatingPointLiteral().getText());
|
||||
return new Literal(TypePlaceholder.fresh(literal.getStart()),
|
||||
value, literal.getStart());
|
||||
}else if(literal.BooleanLiteral() != null){
|
||||
|
@ -370,12 +370,41 @@ public class TYPEStmt implements StatementVisitor{
|
||||
//PL 2018-06-23 Sie haben einen Typ. Der muesste hier eingefuegt werden
|
||||
//wie hier fuer double gezeigt. Im Momment auskommentiert, weil zu wenige Literaltypen
|
||||
//funktionieren
|
||||
//if (literal.value instanceof Double) {
|
||||
// constraintsSet.addUndConstraint(new Pair(literal.getType(), doublee, PairOperator.EQUALSDOT));
|
||||
//}
|
||||
//else {
|
||||
// throw new NotImplementedException();
|
||||
//}
|
||||
if (literal.value instanceof Double) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(), doublee, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Double) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(), longg, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Integer) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(), integer, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Short) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(),shortt, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Byte) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(),bytee, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Float) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(),floatt, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof String) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(),string, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
if (literal.value instanceof Boolean) {
|
||||
constraintsSet.addUndConstraint(new Pair(literal.getType(),bool, PairOperator.EQUALSDOT));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,12 +3,12 @@ import java.lang.Integer;
|
||||
//import java.lang.Byte;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class Matrix extends Vector<Vector<Integer>> {
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
Matrix () {
|
||||
MatrixOP () {
|
||||
}
|
||||
|
||||
Matrix(vv) {
|
||||
MatrixOP(vv) {
|
||||
Integer i;
|
||||
i = 0;
|
||||
while(i < vv.size()) {
|
||||
@ -19,7 +19,7 @@ public class Matrix extends Vector<Vector<Integer>> {
|
||||
}
|
||||
|
||||
mul = (m1, m2) -> {
|
||||
var ret = new Matrix();
|
||||
var ret = new MatrixOP();
|
||||
var i = 0;
|
||||
while(i < size()) {
|
||||
var v1 = m1.elementAt(i);
|
||||
|
Loading…
Reference in New Issue
Block a user