Search in sources :

Example 1 with MethodDeclaration

use of org.eclipse.n4js.n4JS.MethodDeclaration in project n4js by eclipse.

the class N4JSMemberRedefinitionValidator method unusedGenericTypeVariable.

/**
 * GHOLD-234 add warning for unused type variables in function and method declarations (unless the method overrides
 * any other method).
 */
private void unusedGenericTypeVariable(MemberMatrix mm) {
    for (TMember member : mm.owned()) {
        if (member instanceof TMethod) {
            TMethod method = (TMethod) member;
            if (!mm.hasInherited() && !mm.hasImplemented()) {
                // We need the method declaration from the AST in order to pass it to the internal
                // validation function. This is necessary because we want to attach the warning to the actual unused
                // type variable in the method declaration, and the type variable in the type model is not identical
                // to the one in the AST which we actually need.
                // Since method is owned by the type being validated, we can safely navigate back from the type
                // model to the AST without triggering another parse.
                MethodDeclaration methodDeclaration = (MethodDeclaration) method.getAstElement();
                internalCheckNoUnusedTypeParameters(methodDeclaration);
            }
        }
    }
}
Also used : TMethod(org.eclipse.n4js.ts.types.TMethod) MethodDeclaration(org.eclipse.n4js.n4JS.MethodDeclaration) TMember(org.eclipse.n4js.ts.types.TMember)

Aggregations

MethodDeclaration (org.eclipse.n4js.n4JS.MethodDeclaration)1 TMember (org.eclipse.n4js.ts.types.TMember)1 TMethod (org.eclipse.n4js.ts.types.TMethod)1