/** * Extracts the method binding from the token's simple name. The method * binding is either the token's binding (if the parent of token is a * method call or declaration) or the constructor binding of a class * instance creation if the node is the type name of a class instance * creation. * * @param token the token to extract the method binding from * @return the corresponding method binding, or <code>null</code> */ private IBinding getMethodBinding(SemanticToken token) { IBinding binding= null; // work around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=62605 ASTNode node= token.getNode(); ASTNode parent= node.getParent(); while (isTypePath(node, parent)) { node= parent; parent= parent.getParent(); } if (parent != null && node.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) binding= ((ClassInstanceCreation) parent).resolveConstructorBinding(); else binding= token.getBinding(); return binding; }