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

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


        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) {
                    continue;
                }
                Integer classIndex = ISINSTANCE_POSSIBILITIES.get(FullRepIterable.getLastPart(rep).toLowerCase());
View Full Code Here


    private int getLineDefinition(SimpleNode ast2) {
        while (ast2 instanceof Attribute || ast2 instanceof Call) {
            if (ast2 instanceof Attribute) {
                ast2 = ((Attribute) ast2).value;
            } else {
                Call c = (Call) ast2;
                if (c.func != null) {
                    ast2 = c.func;
                } else {
                    break;
                }
View Full Code Here

            node = def.name;
        }
        if (node instanceof Attribute) {
            exprType value = ((Attribute) node).value;
            if (value instanceof Call) {
                Call c = (Call) value;
                node = c.func;
            }
        }
        beginLine = node.beginLine;
        beginCol = node.beginColumn;
View Full Code Here

        ret.addAll(found);
    }

    private void processFoundNameTok(SimpleNode root, List<ASTEntry> ret, NameTok name) {
        if (name.ctx == NameTok.Attrib) {
            Call call = FindCallVisitor.findCall(name, root);
            processCall(ret, call);
        }
    }
View Full Code Here

        }
    }

    private void processFoundName(SimpleNode root, List<ASTEntry> ret, Name name) {
        if (name.ctx == Name.Load) {
            Call call = FindCallVisitor.findCall(name, root);
            processCall(ret, call);
        }
    }
View Full Code Here

                "Method1(10, param2=20)\n" +
                "Method1(param1=10, param2=20)\n" +
                "";
        Module root = (Module) parseLegalDocStr(s);
        Expr expr = (Expr) root.body[1];
        Call call = (Call) expr.value;
        Name name = (Name) call.func;
        FindCallVisitor visitor = new FindCallVisitor(name);
        visitor.traverse(root);
        assertSame(call, visitor.getCall());
        assertSame(call, FindCallVisitor.findCall(name, root));
View Full Code Here

                "";
        Module root = (Module) parseLegalDocStr(s);
        ClassDef classDef = (ClassDef) root.body[0];
        FunctionDef funcDef = (FunctionDef) classDef.body[0];
        Expr expr = (Expr) funcDef.body[1];
        Call call = (Call) expr.value;
        Name name = (Name) call.func;
        FindCallVisitor visitor = new FindCallVisitor(name);
        visitor.traverse(root);
        assertSame(call, visitor.getCall());
        assertSame(call, FindCallVisitor.findCall(name, root));
View Full Code Here

    public Call createCall(String call, List<exprType> params, keywordType[] keywords, exprType starargs,
            exprType kwargs) {
        exprType[] array = params != null ? params.toArray(new Name[params.size()]) : new exprType[0];
        if (call.indexOf(".") != -1) {
            return new Call(createAttribute(call), array, keywords, starargs, kwargs);
        }
        return new Call(new Name(call, Name.Load, false), array, keywords, starargs, kwargs);

    }
View Full Code Here

            while (removePositions.size() > 0) {
                Integer pop = removePositions.pop();
                params.remove((int) pop);
            }
        }
        Call call;
        if (isClassMethod && params.size() > 0) {
            //We need to use the super() construct
            //Something as:
            //Expr[value=
            //    Call[func=
            //        Attribute[value=
            //            Call[func=Name[id=super, ctx=Load, reserved=false], args=[Name[id=Current, ctx=Load, reserved=false], Name[id=cls, ctx=Load, reserved=false]], keywords=[], starargs=null, kwargs=null],
            //        attr=NameTok[id=test, ctx=Attrib], ctx=Load],
            //    args=[], keywords=[], starargs=null, kwargs=null]
            //]

            exprType firstParam = params.remove(0);

            Call innerCall = createCall("super", currentClassName, NodeUtils.getRepresentationString(firstParam));
            Attribute attr = new Attribute(innerCall, new NameTok(NodeUtils.getRepresentationString(functionDef),
                    NameTok.Attrib), Attribute.Load);
            call = new Call(attr, params.toArray(new Name[params.size()]), keywords.toArray(new keywordType[keywords
                    .size()]), starargs, kwargs);

        } else {
            call = createCall(parentClassName + "." + NodeUtils.getRepresentationString(functionDef), params,
                    keywords.toArray(new keywordType[keywords.size()]), starargs, kwargs);
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.