@Override
public Void visitMethodDeclaration(MethodDeclaration node) {
ExecutableElement outerExecutable = enclosingExecutable;
try {
Token property = node.getPropertyKeyword();
SimpleIdentifier methodName = node.getName();
String nameOfMethod = methodName.getName();
if (nameOfMethod.equals(TokenType.MINUS.getLexeme())
&& node.getParameters().getParameters().size() == 0) {
nameOfMethod = "unary-";
}
if (property == null) {
enclosingExecutable = findWithNameAndOffset(
enclosingClass.getMethods(),
nameOfMethod,
methodName.getOffset());
methodName.setStaticElement(enclosingExecutable);
} else {
PropertyAccessorElement accessor = findIdentifier(enclosingClass.getAccessors(), methodName);
if (((KeywordToken) property).getKeyword() == Keyword.SET) {
accessor = accessor.getVariable().getSetter();
methodName.setStaticElement(accessor);
}
enclosingExecutable = accessor;
}
processElement(enclosingExecutable);
return super.visitMethodDeclaration(node);