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

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


                String s = "class C: \n" +
                        "    pass\n" +
                        "#end\n" +
                        "";
                Module ast = (Module) parseLegalDocStr(s);
                ClassDef d = (ClassDef) ast.body[0];
                assertEquals(1, d.specialsAfter.size());
                commentType c = (commentType) d.specialsAfter.get(0);
                assertEquals("#end", c.id);
                return true;
            }
View Full Code Here


    public static int getOffset(IDocument doc, ASTEntry entry) {
        int beginLine;
        int beginCol;
        SimpleNode node = entry.node;
        if (node instanceof ClassDef) {
            ClassDef def = (ClassDef) node;
            node = def.name;
        }
        if (node instanceof FunctionDef) {
            FunctionDef def = (FunctionDef) node;
            node = def.name;
View Full Code Here

                "class A:\n" +
                "    pass\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        ClassDef d = (ClassDef) m.body[0];
        assertEquals(2, d.decs.length);
        assertEquals("classdec", NodeUtils.getRepresentationString(d.decs[0].func));
        assertEquals("classdec2", NodeUtils.getRepresentationString(d.decs[1].func));
    }
View Full Code Here

                "            pass\n" + //17
                "";
        SimpleNode ast = parseLegalDocStr(str);
        stmtType[] body = ((Module) ast).body;
        assertEquals(3, body.length);
        ClassDef test = (ClassDef) body[2];
        body = test.body;
        assertEquals(2, body.length);
        assertEquals(8, test.beginLine);
    }
View Full Code Here

                "\n" +
                "";
        SimpleNode ast = parseLegalDocStr(str);
        stmtType[] body = ((Module) ast).body;
        assertEquals(1, body.length);
        ClassDef classFound = (ClassDef) body[0];
        body = classFound.body;
        assertEquals(1, body.length);
        FunctionDef func = (FunctionDef) body[0];
        If ifFound = (If) func.body[0];
        assertEquals(6, ifFound.orelse.beginLine);
View Full Code Here

    public java.util.List<String> getBaseClassName(SimpleNode node) {
        java.util.List<String> bases = new ArrayList<String>();
        if (isClassDef(node)) {

            ClassDef clazz = (ClassDef) node;
            if (isFilledList(clazz.bases)) {
                for (exprType base : clazz.bases) {
                    bases.add(getName(base));
                }
            }
View Full Code Here

        }
        //Iterate in a copy, since we may change the original...
        for (TreeNode<OutlineEntry> nextEntry : entry.children) {

            if (nextEntry.data.node instanceof ClassDef) {
                ClassDef classDef = (ClassDef) nextEntry.data.node;
                gathered.add(new Tuple<ClassDef, TreeNode<OutlineEntry>>(classDef, nextEntry));
            }

            //Enter the leaf to fill it too.
            gatherClasses(nextEntry, monitor, gathered);
View Full Code Here

                "class A:\n" +
                "    pass\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        ClassDef d = (ClassDef) m.body[0];
        assertEquals(2, d.decs.length);
        assertEquals("classdec", NodeUtils.getRepresentationString(d.decs[0].func));
        assertEquals("classdec2", NodeUtils.getRepresentationString(d.decs[1].func));
    }
View Full Code Here

        String s = "" +
                "class A(meta=B, foo=C):pass\n" +
                "";

        Module node = (Module) parseLegalDocStr(s);
        ClassDef c = (ClassDef) node.body[0];
        assertEquals(2, c.keywords.length);

        parseLegalDocStrWithoutTree(s);
    }
View Full Code Here

                "    def m(self):\n" +
                "        Method1(10, param2=20)\n" +
                "        Method1(param1=10, param2=20)\n" +
                "";
        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);
View Full Code Here

TOP

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

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.