onAddToProbablyNotDefined(token, foundForProbablyNotDefined);
} else {
onAddUndefinedMessage(token, foundForProbablyNotDefined); //it is in the global scope, so, it is undefined.
}
} else {
IToken tokenInNamesToIgnore = foundInNamesToIgnore.o1;
onFoundInNamesToIgnore(token, tokenInNamesToIgnore);
}
}
} else if (checkIfIsValidImportToken) {
//ok, it was found, but is it an attribute (and if so, are all the parts in the import defined?)
//if it was an attribute (say xxx and initially it was xxx.foo, we will have to check if the token foo
//really exists in xxx, if it was found as an import)
try {
if (foundAs.isImport() && !rep.equals(foundAsStr) && foundAs.importInfo != null
&& foundAs.importInfo.wasResolved) {
//the foundAsStr equals the module resolved in the Found tok
IModule m = foundAs.importInfo.mod;
String tokToCheck;
if (foundAs.isWildImport()) {
tokToCheck = foundAsStr;
} else {
String tok = foundAs.importInfo.rep;
tokToCheck = rep.substring(foundAsStr.length() + 1);
if (tok.length() > 0) {
tokToCheck = tok + "." + tokToCheck;
}
}
for (String repToCheck : new FullRepIterable(tokToCheck)) {
int inGlobalTokens = m.isInGlobalTokens(repToCheck, nature, true, true, this.completionCache);
if (inGlobalTokens == IModule.NOT_FOUND) {
if (!isDefinitionUnknown(m, repToCheck)) {
//Check if there's some hasattr (if there is, we'll consider that the token which
//had the hasattr checked will actually have it).
Collection<IToken> interfaceForLocal = this.currentLocalScope.getInterfaceForLocal(
foundAsStr, false, true);
boolean foundInHasAttr = false;
for (IToken iToken : interfaceForLocal) {
if (iToken.getRepresentation().equals(repToCheck)) {
foundInHasAttr = true;
break;
}
}
if (!foundInHasAttr) {
IToken foundTok = findNameTok(token, repToCheck);
onAddUndefinedVarInImportMessage(foundTok, foundAs);
}
}
break;//no need to keep checking once one is not defined