}
return new Tuple<Boolean, String>(isActuallyUndefined, rep);
}
public void onArgumentsMismatch(IToken token, Call callNode) {
FastStringBuffer buf = new FastStringBuffer(128);
buf.append(token.getRepresentation());
buf.append(": arguments don't match");
List<IMessage> msgs = getMsgsList(token);
//Code that'll gather the position of the start/end parenthesis and will create a message at that location
//(otherwise, it'd create the message at the name location, which may be a bit confusing).
ParsingUtils parsingUtils = ParsingUtils.create(document);
try {
int offset = PySelection.getAbsoluteCursorOffset(document, callNode.func.beginLine - 1,
callNode.func.beginColumn - 1); //-1: from ast to document coords
int openParensPos = parsingUtils.findNextChar(offset, '(');
if (openParensPos != -1) {
int closeParensPos = parsingUtils.eatPar(openParensPos, null);
if (closeParensPos != -1) {
int startLine = PySelection.getLineOfOffset(document, openParensPos) + 1; //+1: from document to ast
int endLine = PySelection.getLineOfOffset(document, closeParensPos) + 1;
int startCol = openParensPos - document.getLineInformationOfOffset(openParensPos).getOffset() + 1;
//+1 doc to ast +1 because we also want to get the closing ')' char.
int endCol = closeParensPos - document.getLineInformationOfOffset(closeParensPos).getOffset() + 1
+ 1;
Message messageToAdd = new Message(IAnalysisPreferences.TYPE_ARGUMENTS_MISATCH, buf.toString(),
startLine, endLine, startCol, endCol, prefs);
doAddMessage(msgs, messageToAdd);
return;
}
}
} catch (BadLocationException e) {
Log.log(e);
} catch (SyntaxErrorException e) {
//Just ignore
}
//If some error happened getting the parens position, just add it to the name.
doAddMessage(msgs, IAnalysisPreferences.TYPE_ARGUMENTS_MISATCH, buf.toString(), token);
}