From 4b21f03a5a2a1162d4bf0e7e7a4ed53ac6a2a4d0 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 30 Aug 2017 14:36:40 +0200 Subject: [PATCH] Refactoring --- src/de/dhbwstuttgart/syntaxtree/ASTVisitor.java | 2 -- .../syntaxtree/StatementVisitor.java | 2 ++ .../syntaxtree/statement/LambdaParameter.java | 17 ----------------- .../typeinference/typeAlgo/TYPEStmt.java | 17 +++++++---------- 4 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 src/de/dhbwstuttgart/syntaxtree/statement/LambdaParameter.java diff --git a/src/de/dhbwstuttgart/syntaxtree/ASTVisitor.java b/src/de/dhbwstuttgart/syntaxtree/ASTVisitor.java index fde9fc83..9d3a7f6d 100644 --- a/src/de/dhbwstuttgart/syntaxtree/ASTVisitor.java +++ b/src/de/dhbwstuttgart/syntaxtree/ASTVisitor.java @@ -10,8 +10,6 @@ public interface ASTVisitor extends StatementVisitor{ void visit(SourceFile sourceFile); - void visit(ArgumentList argumentList); - void visit(GenericTypeVar genericTypeVar); void visit(FormalParameter formalParameter); diff --git a/src/de/dhbwstuttgart/syntaxtree/StatementVisitor.java b/src/de/dhbwstuttgart/syntaxtree/StatementVisitor.java index dce80777..b912fab6 100644 --- a/src/de/dhbwstuttgart/syntaxtree/StatementVisitor.java +++ b/src/de/dhbwstuttgart/syntaxtree/StatementVisitor.java @@ -8,6 +8,8 @@ import de.dhbwstuttgart.syntaxtree.statement.literal.StringLiteral; public interface StatementVisitor { + void visit(ArgumentList argumentList); + void visit(LambdaExpression lambdaExpression); void visit(Assign assign); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaParameter.java b/src/de/dhbwstuttgart/syntaxtree/statement/LambdaParameter.java deleted file mode 100644 index b2bf4228..00000000 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaParameter.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.dhbwstuttgart.syntaxtree.statement; - -import de.dhbwstuttgart.syntaxtree.FormalParameter; - -/** - * Der FormalParameter einer LambdaExpression hat gesonderte Eigenschaften. - * @author janulrich - * - */ -public class LambdaParameter extends FormalParameter { - - public LambdaParameter(FormalParameter fp) { - super(null,null,null); - } - - -} diff --git a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index 34f17a56..55f92378 100644 --- a/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -42,6 +42,13 @@ public class TYPEStmt implements StatementVisitor{ return constraintsSet; } + @Override + public void visit(ArgumentList arglist) { + for(int i = 0;i methodConstraints = new HashSet<>(); for(MethodAssumption m : this.getMethods(methodCall.name, methodCall.arglist, info)){ @@ -150,7 +156,6 @@ public class TYPEStmt implements StatementVisitor{ @Override public void visit(NewClass methodCall) { - constraintsSet.addAll(this.getArgumentListConstraints(methodCall, info)); //Overloading: Set methodConstraints = new HashSet<>(); for(MethodAssumption m : this.getConstructors(info, (RefType) methodCall.getType(), methodCall.getArgumentList())){ @@ -290,14 +295,6 @@ public class TYPEStmt implements StatementVisitor{ return params; } - public ConstraintSet getArgumentListConstraints(MethodCall forMethod, TypeInferenceBlockInformation info) { - TYPEStmt ret = new TYPEStmt(info); - for(int i = 0;i getConstructors(TypeInferenceBlockInformation info, RefType ofType, ArgumentList argList){ List ret = new ArrayList<>(); for(ClassOrInterface cl : info.getAvailableClasses()){