Search in sources :

Example 1 with JvmAnyTypeReference

use of org.eclipse.xtext.common.types.JvmAnyTypeReference in project xtext-xtend by eclipse.

the class XtendHoverSignatureProvider method _signature.

protected String _signature(XtendFunction function, boolean typeAtEnd) {
    JvmOperation inferredOperation = associations.getDirectlyInferredOperation(function);
    if (inferredOperation != null) {
        String returnTypeString = "void";
        JvmTypeReference returnType = inferredOperation.getReturnType();
        if (returnType != null) {
            if (returnType instanceof JvmAnyTypeReference) {
                throw new IllegalStateException();
            } else {
                returnTypeString = getTypeName(returnType);
            }
        }
        StringBuilder signature = new StringBuilder();
        String typeParameter = uiStrings.typeParameters(function.getTypeParameters());
        if (typeParameter != null && typeParameter.length() > 0) {
            signature.append(typeParameter).append(" ");
        }
        signature.append(returnTypeString).append(" ");
        signature.append(function.getName()).append(hoverUiStrings.parameters(inferredOperation));
        signature.append(getThrowsDeclaration(inferredOperation));
        return signature.toString();
    }
    return function.getName() + "()";
}
Also used : JvmOperation(org.eclipse.xtext.common.types.JvmOperation) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) JvmAnyTypeReference(org.eclipse.xtext.common.types.JvmAnyTypeReference)

Aggregations

JvmAnyTypeReference (org.eclipse.xtext.common.types.JvmAnyTypeReference)1 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)1 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)1