Additive Expression implementieren

This commit is contained in:
JanUlrich 2018-02-21 11:40:54 +01:00
parent ed3a3909c0
commit c747ab0885

View File

@ -599,8 +599,8 @@ public class StatementGenerator {
} }
private BinaryExpr.Operator convertBinaryOperator(String operator) { private BinaryExpr.Operator convertBinaryOperator(String operator) {
//return BinaryExpr.Operator.ADD;
return null; throw new NotImplementedException();
} }
private Expression convert(Java8Parser.ShiftExpressionContext expression) { private Expression convert(Java8Parser.ShiftExpressionContext expression) {
@ -612,12 +612,15 @@ public class StatementGenerator {
} }
private Expression convert(Java8Parser.AdditiveExpressionContext expression) { private Expression convert(Java8Parser.AdditiveExpressionContext expression) {
if(expression.additiveExpression() != null){
return convert(expression.additiveExpression()); if(expression.additiveExpression() == null){
}else if(expression.multiplicativeExpression() != null){
return convert(expression.multiplicativeExpression()); return convert(expression.multiplicativeExpression());
}else{ }else {
throw new NotImplementedException(); Expression leftSide = convert(expression.additiveExpression());
Expression rightSide = convert(expression.multiplicativeExpression());
BinaryExpr.Operator op = convertBinaryOperator(expression.getChild(1).getText());
Token offset = expression.getStart();
return new BinaryExpr(op, TypePlaceholder.fresh(expression.getStart()), leftSide, rightSide, offset);
} }
} }