Examples of Found


Examples of com.python.pydev.analysis.visitors.Found

                List<IToken> createdTokens = AbstractVisitor.makeImportToken(importTok, null, this.current.getName(),
                        true);
                for (IToken token : createdTokens) {
                    ImportInfo info = this.scope.importChecker.visitImportToken(token, false, this.completionCache);
                    Found found = new Found(token, token, scope.getCurrScopeId(), scope.getCurrScopeItems());
                    found.importInfo = info;

                    checkFound(found, peekParent()); //check if this is actually a match
                    addFoundToImportsMap(found, importsFoundFromModuleName);
                }
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

            builtinCompletions.add(new SourceToken(new Name("__path__", Name.Load, false), "__path__", "", "",
                    moduleName));
        }

        for (IToken t : builtinCompletions) {
            Found found = makeFound(t);
            com.aptana.shared_core.structure.Tuple<IToken, Found> tup = new com.aptana.shared_core.structure.Tuple<IToken, Found>(t, found);
            addToNamesToIgnore(t, scope.getCurrScopeItems(), tup);
            builtinTokens.add(t.getRepresentation());
        }
    }
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

            }
        }

        ScopeItems currScopeItems = scope.getCurrScopeItems();

        Found found = new Found(token, token, scope.getCurrScopeId(), scope.getCurrScopeItems());
        com.aptana.shared_core.structure.Tuple<IToken, Found> tup = new com.aptana.shared_core.structure.Tuple<IToken, Found>(token, found);
        addToNamesToIgnore(token, currScopeItems, tup);

        //after adding it to the names to ignore, let's see if there is someone waiting for this declaration
        //in the 'probably not defined' stack.
        for (Iterator<Found> it = probablyNotDefined.iterator(); it.hasNext();) {
            Found n = it.next();

            GenAndTok single = n.getSingle();
            int foundScopeType = single.scopeFound.getScopeType();
            //ok, if we are in a scope method, we may not get things that were defined in a class scope.
            if (((foundScopeType & Scope.ACCEPTED_METHOD_AND_LAMBDA) != 0)
                    && scope.getCurrScopeItems().getScopeType() == Scope.SCOPE_TYPE_CLASS) {
                continue;
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

    protected void endScope(SimpleNode node) {
        onBeforeEndScope(node);

        ScopeItems m = scope.endScope(); //clear the last scope
        for (Iterator<Found> it = probablyNotDefined.iterator(); it.hasNext();) {
            Found n = it.next();

            final GenAndTok probablyNotDefinedFirst = n.getSingle();
            IToken tok = probablyNotDefinedFirst.tok;
            String rep = tok.getRepresentation();
            //we also get a last pass to the unused to see if they might have been defined later on the higher scope

            List<Found> foundItems = find(m, rep);
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

     * @param addToNotDefined determines if it should be added to the 'not defined tokens' stack or not
     * @return true if it was found
     */
    protected boolean markRead(IToken token, String rep, boolean addToNotDefined, boolean checkIfIsValidImportToken) {
        boolean found = false;
        Found foundAs = null;
        String foundAsStr = null;

        int acceptedScopes = 0;
        ScopeItems currScopeItems = scope.getCurrScopeItems();

        if ((currScopeItems.getScopeType() & Scope.ACCEPTED_METHOD_AND_LAMBDA) != 0) {
            acceptedScopes = Scope.ACCEPTED_METHOD_SCOPES;
        } else {
            acceptedScopes = Scope.ACCEPTED_ALL_SCOPES;
        }

        if ("locals".equals(rep)) {
            //if locals() is accessed, all the tokens currently found are marked as 'used'
            //use case:
            //
            //def f2():
            //    a = 1
            //    b = 2
            //    c = 3
            //    f1(**locals())
            currScopeItems.setAllUsed();
            return true;
        }

        Iterator<String> it = new FullRepIterable(rep, true).iterator();
        //search for it
        while (found == false && it.hasNext()) {
            String nextTokToSearch = it.next();
            foundAs = scope.findFirst(nextTokToSearch, true, acceptedScopes);
            found = foundAs != null;
            if (found) {
                foundAsStr = nextTokToSearch;
                foundAs.getSingle().references.add(token);
                onFoundTokenAs(token, foundAs);
            }
        }

        if (!found) {
            //this token might not be defined... (still, might be in names to ignore)
            int i;
            if ((i = rep.indexOf('.')) != -1) {
                //if it is an attribute, we have to check the names to ignore just with its first part
                rep = rep.substring(0, i);
            }
            if (addToNotDefined) {
                com.aptana.shared_core.structure.Tuple<IToken, Found> foundInNamesToIgnore = findInNamesToIgnore(rep, token);
                if (foundInNamesToIgnore == null) {
                    Found foundForProbablyNotDefined = makeFound(token);
                    if (scope.size() > 1) { //if we're not in the global scope, it might be defined later
                        probablyNotDefined.add(foundForProbablyNotDefined); //we are not in the global scope, so it might be defined later...
                        onAddToProbablyNotDefined(token, foundForProbablyNotDefined);
                    } else {
                        onAddUndefinedMessage(token, foundForProbablyNotDefined); //it is in the global scope, so, it is undefined.
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

        }
        return false;
    }

    protected Found makeFound(IToken token) {
        return new Found(token, token, scope.getCurrScopeId(), scope.getCurrScopeItems());
    }
View Full Code Here

Examples of com.python.pydev.analysis.visitors.Found

        //now, on the workspace, we need to find the module definition as well as the imports for it...
        //the local scope should have already determined which is the module to be renamed (unless it
        //is an unresolved import, in which case we'll only make a local refactor)
        if (docOccurrences.size() != 0) {
            ASTEntry entry = docOccurrences.iterator().next();
            Found found = (Found) entry
                    .getAdditionalInfo(ScopeAnalyzerVisitor.FOUND_ADDITIONAL_INFO_IN_AST_ENTRY, null);
            if (found == null) {
                throw new RuntimeException("Expecting decorated entry.");
            }
            if (found.importInfo == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.