Search in sources :

Example 11 with Found

use of com.python.pydev.analysis.visitors.Found in project Pydev by fabioz.

the class ScopeAnalyzerVisitorWithoutImports method onAfterEndScope.

@Override
protected void onAfterEndScope(SimpleNode node, ScopeItems m) {
    ASTEntry parent = popParent(node);
    if (hitAsUndefined == null) {
        for (String rep : new FullRepIterable(this.completeNameToFind, true)) {
            List<Found> foundItems = m.getAll(rep);
            for (Found found : foundItems) {
                if (checkFound(found, parent) != null) {
                    return;
                }
            }
        }
    } else {
        // (hitAsUndefined != null)
        String foundRep = hitAsUndefined.getSingle().generator.getRepresentation();
        if (foundRep.indexOf('.') == -1 || FullRepIterable.containsPart(foundRep, nameToFind)) {
            // we cannot get the locals
            for (Found f : this.undefinedFound) {
                if (f.getSingle().generator.getRepresentation().startsWith(foundRep)) {
                    if (foundOccurrences.size() == 1) {
                        Tuple3<Found, Integer, ASTEntry> hit = foundOccurrences.get(0);
                        Tuple3<Found, Integer, ASTEntry> foundOccurrence = new Tuple3<Found, Integer, ASTEntry>(f, hit.o2, hit.o3);
                        addFoundOccurrence(foundOccurrence);
                    }
                }
            }
        }
    }
}
Also used : FullRepIterable(org.python.pydev.shared_core.string.FullRepIterable) Tuple3(org.python.pydev.shared_core.structure.Tuple3) ASTEntry(org.python.pydev.parser.visitors.scope.ASTEntry) Found(com.python.pydev.analysis.visitors.Found)

Aggregations

Found (com.python.pydev.analysis.visitors.Found)11 IToken (org.python.pydev.core.IToken)9 ASTEntry (org.python.pydev.parser.visitors.scope.ASTEntry)6 SourceToken (org.python.pydev.ast.codecompletion.revisited.modules.SourceToken)4 Tuple4 (org.python.pydev.shared_core.structure.Tuple4)4 GenAndTok (com.python.pydev.analysis.visitors.GenAndTok)3 ScopeItems (com.python.pydev.analysis.visitors.ScopeItems)3 ArrayList (java.util.ArrayList)3 Import (org.python.pydev.parser.jython.ast.Import)3 FullRepIterable (org.python.pydev.shared_core.string.FullRepIterable)3 Tuple3 (org.python.pydev.shared_core.structure.Tuple3)3 ImportInfo (com.python.pydev.analysis.visitors.ImportChecker.ImportInfo)2 HashSet (java.util.HashSet)2 SimpleNode (org.python.pydev.parser.jython.SimpleNode)2 NameTok (org.python.pydev.parser.jython.ast.NameTok)2 org.python.pydev.parser.jython.ast.aliasType (org.python.pydev.parser.jython.ast.aliasType)2 List (java.util.List)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 SourceModule (org.python.pydev.ast.codecompletion.revisited.modules.SourceModule)1