void (JSReferenceExpression methodExpr) { ResolveResult[] results = methodExpr.multiResolve(false); PsiElement elt; if (results.length > 0 && ((elt = results[0].getElement()) instanceof JSFunction && ((JSFunction)elt).isConstructor() || elt instanceof JSClass )) { foo(); } }