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

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


        ClassDef classDefBar = (ClassDef) m.body[0];
        assertEquals(1, classDefBar.beginColumn);
        assertEquals(1, classDefBar.beginLine);
        assertEquals("Bar", ((NameTok) classDefBar.name).id);

        FunctionDef defM2 = (FunctionDef) classDefBar.body[0];
        assertEquals("m2", ((NameTok) (defM2).name).id);
        assertEquals(5, defM2.beginColumn);
        assertEquals(2, defM2.beginLine);

        Assign a = (Assign) defM2.body[0];
View Full Code Here


        ClassDef classDefBar = (ClassDef) m.body[0];
        assertEquals(1, classDefBar.beginColumn);
        assertEquals(1, classDefBar.beginLine);
        assertEquals("Bar", ((NameTok) classDefBar.name).id);

        FunctionDef defM2 = (FunctionDef) classDefBar.body[0];
        assertEquals("m2", ((NameTok) (defM2).name).id);
        assertEquals(5, defM2.beginColumn);
        assertEquals(2, defM2.beginLine);

        Assign a = (Assign) defM2.body[0];
View Full Code Here

        ClassDef classDef = (ClassDef) m.body[0];
        assertEquals(1, classDef.beginColumn);
        assertEquals(5, classDef.beginLine);
        assertEquals("Test", ((NameTok) classDef.name).id);

        FunctionDef def = (FunctionDef) classDef.body[0];
        assertEquals("MockMethod", ((NameTok) (def).name).id);
        assertEquals(5, def.beginColumn);
        assertEquals(7, def.beginLine);

        def = (FunctionDef) classDef.body[1];
View Full Code Here

                        "                mdigits_msg = ''%s': DecimalFields require a 'max_digits' attribute that is a positive integer.'\n"
                        +
                        "" +
                        "");
        assertEquals(1, m.body.length);
        FunctionDef d = (FunctionDef) m.body[0];
        assertEquals("get_validation_errors", NodeUtils.getRepresentationString(d.name));
        assertNull(d.body);
    }
View Full Code Here

                "        self.bar = 10\n" +
                "def another():\n" +
                "    b = 20\n" +
                "");
        assertEquals(3, m.body.length);
        FunctionDef d = (FunctionDef) m.body[0];
        assertEquals("method", NodeUtils.getRepresentationString(d.name));
        assertNull(d.body);

        ClassDef cd = (ClassDef) m.body[1];
        assertEquals("F", NodeUtils.getRepresentationString(cd.name));
View Full Code Here

                        "    def met1(self, a):\n" +
                        "        pass";
                SimpleNode node = parseLegalDocStr(s);
                Module m = (Module) node;
                ClassDef d = (ClassDef) m.body[0];
                FunctionDef f = (FunctionDef) d.body[0];
                assertEquals("self", ((Name) f.args.args[0]).id);
                assertEquals("a", ((Name) f.args.args[1]).id);
                return true;
            }
        });
View Full Code Here

        if (node instanceof ClassDef) {
            ClassDef def = (ClassDef) node;
            node = def.name;
        }
        if (node instanceof FunctionDef) {
            FunctionDef def = (FunctionDef) node;
            node = def.name;
        }
        if (node instanceof Attribute) {
            exprType value = ((Attribute) node).value;
            if (value instanceof Call) {
View Full Code Here

                        "def m():\n" +
                        "    call(a,";
                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                assertEquals(1, m.body.length);
                FunctionDef f = (FunctionDef) m.body[0];
                assertEquals("m", NodeUtils.getRepresentationString(f));
                return true;
            }
        });
View Full Code Here

    }

    private void init(Definition definition) {
        Assert.isNotNull(definition.scope, "The scope for a rename parameter must always be provided.");

        FunctionDef node;
        if (definition.ast instanceof FunctionDef) {
            node = (FunctionDef) definition.ast;
        } else {
            node = (FunctionDef) definition.scope.getScopeStack().peek();
        }
View Full Code Here

    }

    private void processFunctionDef(List<ASTEntry> ret, ASTEntry entry) {
        //this is the actual function definition, so, let's take a look at its arguments...

        FunctionDef node = (FunctionDef) entry.parent.node;
        List<ASTEntry> found = ScopeAnalysis.getLocalOccurrences(request.initialName, node);
        ret.addAll(ScopeAnalysis.getStringOccurrences(request.initialName, node));
        ret.addAll(found);
    }
View Full Code Here

TOP

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

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.