Refactoring
This commit is contained in:
parent
a7e1a5e2c2
commit
4b21f03a5a
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -42,6 +42,13 @@ public class TYPEStmt implements StatementVisitor{
|
||||
return constraintsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(ArgumentList arglist) {
|
||||
for(int i = 0;i<arglist.getArguments().size();i++){
|
||||
arglist.getArguments().get(i).accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(LambdaExpression lambdaExpression) {
|
||||
TypePlaceholder tphRetType = TypePlaceholder.fresh(new NullToken());
|
||||
@ -136,7 +143,6 @@ public class TYPEStmt implements StatementVisitor{
|
||||
@Override
|
||||
public void visit(MethodCall methodCall) {
|
||||
methodCall.receiver.accept(this);
|
||||
constraintsSet.addAll(this.getArgumentListConstraints(methodCall, info));
|
||||
//Overloading:
|
||||
Set<Constraint> 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<Constraint> 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<forMethod.arglist.getArguments().size();i++){
|
||||
forMethod.arglist.getArguments().get(i).accept(ret);
|
||||
}
|
||||
return ret.constraintsSet;
|
||||
}
|
||||
|
||||
public List<MethodAssumption> getConstructors(TypeInferenceBlockInformation info, RefType ofType, ArgumentList argList){
|
||||
List<MethodAssumption> ret = new ArrayList<>();
|
||||
for(ClassOrInterface cl : info.getAvailableClasses()){
|
||||
|
Loading…
Reference in New Issue
Block a user