Examples of ASTEntry


Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            List<ICompletionProposal> ret) {
        for (ItemPointer pointer : pointers) {
            Definition definition = pointer.definition;
            if (definition != null && definition.ast instanceof ClassDef) {
                ClassDef d = (ClassDef) definition.ast;
                ASTEntry initEntry = findInitInClass(d);

                if (initEntry == null) {
                    //Give the user a chance to create the __init__.
                    PyCreateMethodOrField pyCreateMethod = new PyCreateMethodOrField();
                    pyCreateMethod.setCreateAs(PyCreateMethodOrField.BOUND_METHOD);
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

    public static ASTEntry findInitInClass(ClassDef d) {
        EasyASTIteratorVisitor visitor = EasyASTIteratorVisitor.create(d);

        for (Iterator<ASTEntry> it = visitor.getMethodsIterator(); it.hasNext();) {
            ASTEntry next = it.next();
            if (next.node != null) {
                String rep = NodeUtils.getRepresentationString(next.node);
                if ("__init__".equals(rep)) {
                    return next;
                }
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                            HashMap<SimpleNode, TreeItem> c = new HashMap<SimpleNode, TreeItem>();

                            boolean first = true;
                            while (outline.hasNext()) {
                                ASTEntry entry = outline.next();

                                if (first) {
                                    //Don't add the class itself.
                                    first = false;
                                    continue;
                                }

                                TreeItem item = null;
                                if (entry.node instanceof FunctionDef) {
                                    item = createTreeItem(c, entry);
                                    item.setImage(PydevPlugin.getImageCache().get(UIConstants.METHOD_ICON));
                                    if (model.module != null) {
                                        item.setData(new ItemPointer(model.module.getFile(),
                                                ((FunctionDef) entry.node).name));
                                    }

                                } else if (entry.node instanceof ClassDef) {
                                    item = createTreeItem(c, entry);
                                    item.setImage(PydevPlugin.getImageCache().get(UIConstants.CLASS_ICON));
                                    if (model.module != null) {
                                        item.setData(new ItemPointer(model.module.getFile(),
                                                ((ClassDef) entry.node).name));
                                    }

                                } else {
                                    item = createTreeItem(c, entry);
                                    item.setImage(PydevPlugin.getImageCache().get(UIConstants.PUBLIC_ATTR_ICON));
                                    if (model.module != null) {
                                        item.setData(new ItemPointer(model.module.getFile(), entry.node));
                                    }
                                }
                                item.setText(entry.getName());
                                item.setExpanded(true);
                            }
                        }
                    }
                }

                private TreeItem createTreeItem(HashMap<SimpleNode, TreeItem> c, ASTEntry entry) {
                    TreeItem parent = null;

                    ASTEntry par = entry.parent;
                    if (par != null) {
                        parent = c.get(par.node);
                    }

                    TreeItem item;
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

                        return false;
                    } else if (token instanceof Name) {
                        if (parentElement instanceof ParsedItem) {
                            ParsedItem parentItem = (ParsedItem) parentElement;
                            if (parentItem != null) {
                                ASTEntry ast = parentItem.getAstThis();
                                if (ast != null) {
                                    SimpleNode parentToken = ast.node;

                                    if (parentToken instanceof ClassDef) {
                                        return false;
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            request.communicateWork("Analyzing:" + m.getName());

            Iterator<ASTEntry> entries = EasyASTIteratorVisitor.createClassIterator(m.getAst());

            while (entries.hasNext()) {
                ASTEntry entry = entries.next();
                //we're checking for those that have model.name as a parent
                ClassDef def = (ClassDef) entry.node;
                List<String> parentNames = NodeUtils.getParentNames(def, true);
                if (parentNames.contains(toFindOnRound.name)) {
                    HierarchyNodeModel newNode = new HierarchyNodeModel(module, def);
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

            classes.add(Call.class);
        }
        Iterator<ASTEntry> iterator = visitor.getIterator(classes.toArray(new Class[classes.size()]));

        while (iterator.hasNext()) {
            ASTEntry entry = iterator.next();
            if (entry.node instanceof Attribute) {
                String rep = NodeUtils.getFullRepresentationString(entry.node);
                if (rep.startsWith(dottedActTok)) {
                    rep = rep.substring(dottedActTok.length());
                    if (NodeUtils.isValidNameRepresentation(rep)) { //that'd be something that can happen when trying to recreate the parsing
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

        //ok, that's the scope we have to analyze
        SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(element);
        Iterator<ASTEntry> iterator = visitor.getIterator(Assert.class);

        while (iterator.hasNext()) {
            ASTEntry entry = iterator.next();
            Assert ass = (Assert) entry.node;
            if (ass.test instanceof Call) {
                Call call = (Call) ass.test;
                String rep = NodeUtils.getFullRepresentationString(call.func);
                if (rep == null) {
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

    @Override
    protected void onLastScope(ScopeItems m) {
        //not found
        for (Found found : probablyNotDefined) {
            ASTEntry parent = peekParent();
            if (checkFound(found, parent) == null) {
                //ok, it was actually not found, so, after marking it as an occurrence, we have to check all
                //the others that have the same representation in its scope.
                String rep = found.getSingle().generator.getRepresentation();
                if (FullRepIterable.containsPart(rep, nameToFind)) {
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

        addFoundOccurrence(tup);
    }

    @Override
    protected void onAddUndefinedMessage(IToken token, Found found) {
        ASTEntry parent = peekParent();
        if (checkFound(found, parent) == null) {
            //ok, it was actually not found, so, after marking it as an occurrence, we have to check all
            //the others that have the same representation in its scope.
            if (token.getRepresentation().equals(nameToFind)) {
                undefinedFound.add(found);
View Full Code Here

Examples of org.python.pydev.parser.visitors.scope.ASTEntry

    /**
     * If the 'parents' stack is higher than 0, peek it (may return null)
     */
    protected ASTEntry peekParent() {
        ASTEntry parent = null;
        if (parents.size() > 0) {
            parent = parents.peek();
        }
        return parent;
    }
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.