// can't link to the constructor as it's synthetic
scan(nt.getIdentifier());
} else {
// TODO: the identifier tree might contain type parameters, packaga names, etc.
// we should visit those
gen.add(new MethodRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getColNumber(lineMap, sp), ee));
}
}
scan(nt.getEnclosingExpression());
scan(nt.getArguments());
scan(nt.getTypeArguments());
scan(nt.getClassBody());
return _;
}
// TODO: how is the 'super' or 'this' constructor invocation handled?
/**
* Method invocation of the form "exp.method()"
*/
public Void visitMethodInvocation(MethodInvocationTree mi, Void _) {
ExpressionTree ms = mi.getMethodSelect(); // PRIMARY.methodName portion
Element e = TreeUtil.getElement(mi);
if (e instanceof ExecutableElement) {// this check is needed in case the source code contains errors
ExecutableElement ee = (ExecutableElement) e;
Name methodName = ee.getSimpleName();
long ep = srcPos.getEndPosition(cu, ms);
if(ep>=0) {
// marker for the method name (and jump to definition)
long sp = ep - methodName.length();
gen.add(new MethodRef(sp, ep, PositionUtils.getLineNumber(lineMap, sp), PositionUtils.getColNumber(lineMap, sp), ee));
}
}
return super.visitMethodInvocation(mi,_);
}