use of dyvilx.tools.compiler.ast.generic.MapTypeContext in project Dyvil by Dyvil.
the class LambdaExpr method inferReturnType.
public void inferReturnType(IType type, IType valueType) {
if (this.hasImplicitReturnType()) {
this.returnType = valueType;
}
if ((this.flags & LAMBDA_TYPE_INFERRED) != 0 || type.canExtract(LambdaType.class)) {
this.type = this.makeType();
return;
}
final ITypeContext tempContext = new MapTypeContext();
final ParameterList methodParams = this.method.getParameters();
final int size = Math.min(this.parameters.size(), methodParams.size());
for (int i = 0; i < size; i++) {
final IParameter lambdaParam = this.parameters.get(i);
final IParameter methodParam = methodParams.get(i);
methodParam.getType().inferTypes(lambdaParam.getType(), tempContext);
}
this.method.getType().inferTypes(valueType, tempContext);
final IType classType = this.method.getEnclosingClass().getThisType();
this.type = classType.getConcreteType(tempContext);
}
Aggregations