Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.Call


            //expected class and so on, so, this should be configured somehow
            if (assignDefinition != null) {

                Assign assign = (Assign) assignDefinition.ast;
                if (assign.value instanceof Call) {
                    Call call = (Call) assign.value;
                    String lastPart = FullRepIterable.getLastPart(assignDefinition.value);
                    Integer parameterIndex = CALLS_FOR_ASSIGN_WITH_RESULTING_CLASS.get(lastPart.toLowerCase());
                    if (parameterIndex != null && call.args.length >= parameterIndex) {
                        String rep = NodeUtils.getFullRepresentationString(call.args[parameterIndex - 1]);
View Full Code Here


            args = extractArgs(origin.args);
            starargs = extractStarargs(origin.args);
            kwargs = extractKwargs(origin.args);
        }

        Call funCall = new Call(createAttribute(), args, null, starargs, kwargs);

        return funCall;
    }
View Full Code Here

            FunctionDef def = (FunctionDef) node;
            return ((NameTok) def.name).id;
        }

        if (node instanceof Call) {
            Call call = ((Call) node);
            return getRepresentationString(call.func, useTypeRepr);
        }

        if (node instanceof org.python.pydev.parser.jython.ast.List || node instanceof ListComp) {
            String val = "[]";
View Full Code Here

        if (node instanceof Subscript) {
            return getFullRepresentationString(((Subscript) node).value);
        }

        if (node instanceof Call) {
            Call c = (Call) node;
            node = c.func;
            if (Reflection.hasAttr(node, "value") && Reflection.hasAttr(node, "attr")) {
                return getFullRepresentationString((SimpleNode) Reflection.getAttrObj(node, "value")) + "."
                        + discoverRep(Reflection.getAttrObj(node, "attr"));
            }
View Full Code Here

        }

        //call and subscript are special cases, because they are not gotten directly (we have to go to the first
        //part of it (which in turn may be an attribute)
        else if (ast2 instanceof Call) {
            Call c = (Call) ast2;
            return getColDefinition(c.func);

        } else if (ast2 instanceof Subscript) {
            Subscript s = (Subscript) ast2;
            return getColDefinition(s.value);
View Full Code Here

        exprType first = null;
        Attribute last = null;
        Attribute attr = null;
        for (int i = dotSplit.size() - 1; i > 0; i--) {
            Call call = null;
            String part = dotSplit.get(i);
            if (part.endsWith("()")) {
                if (i == dotSplit.size() - 1) {
                    part = part.substring(0, part.length() - 2);
                    call = new Call(null, new exprType[0], new keywordType[0], null, null);
                    first = call;
                } else {
                    throw new RuntimeException("Call only accepted in the last part.");
                }
            }
            attr = new Attribute(null, new NameTok(part, NameTok.Attrib), Attribute.Load);
            if (call != null) {
                call.func = attr;
            }
            if (last != null) {
                last.value = attr;
            }
            last = attr;
            if (first == null) {
                first = last;
            }
        }

        String lastPart = dotSplit.get(0);
        if (lastPart.endsWith("()")) {
            last.value = new Call(new Name(lastPart.substring(0, lastPart.length() - 2), Name.Load, false), null, null,
                    null, null);
        } else {
            last.value = new Name(lastPart, Name.Load, false);
        }
        return first;
View Full Code Here

                        args.add(0, (exprType) node);
                    }
                }

                exprType func = (exprType) stack.popNode();
                Call c = new Call(func, args.toArray(new exprType[args.size()]),
                        keywords.toArray(new keywordType[keywords.size()]), starargs, kwargs);
                addSpecialsAndClearOriginal(n, c);
                return c;
            case JJTFUNCDEF:
                suite = (Suite) stack.popNode();
View Full Code Here

                    if (!(tmparr[i] instanceof keywordType))
                        throw new ParseException("non-keyword argument following keyword", tmparr[i]);
                    keywords[i - nargs] = (keywordType) tmparr[i];
                }
                exprType func = (exprType) stack.popNode();
                Call c = new Call(func, args, keywords, starargs, kwargs);
                addSpecialsAndClearOriginal(n, c);
                return c;
            case JJTFUNCDEF:
                //get the decorators
                //and clear them for the next call (they always must be before a function def)
View Full Code Here

                    if (!(tmparr[i] instanceof keywordType))
                        throw new ParseException("non-keyword argument following keyword", tmparr[i]);
                    keywords[i - nargs] = (keywordType) tmparr[i];
                }
                exprType func = (exprType) stack.popNode();
                Call c = new Call(func, args, keywords, starargs, kwargs);
                addSpecialsAndClearOriginal(n, c);
                return c;
            case JJTFUNCDEF:
                //get the decorators
                //and clear them for the next call (they always must be before a function def)
View Full Code Here

                        comps.add(new SourceToken(entry.node, FullRepIterable.getFirstPart(rep), "", "", "",
                                IToken.TYPE_OBJECT_FOUND_INTERFACE));
                    }
                }
            } else if (entry.node instanceof Call) {
                Call call = (Call) entry.node;
                if ("hasattr".equals(NodeUtils.getFullRepresentationString(call.func)) && call.args != null
                        && call.args.length == 2) {
                    String rep = NodeUtils.getFullRepresentationString(call.args[0]);
                    if (rep.equals(activationToken)) {
                        exprType node = call.args[1];
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.Call

Copyright © 2018 www.massapicom. 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.