Package org.python.indexer.ast

Examples of org.python.indexer.ast.NFunctionDef


        assertNoneType(new NEllipsis());
        assertNoneType(new NExceptHandler(null, null, null));
        assertNoneType(new NExec(null, null, null));
        assertNoneType(new NExprStmt(null));
        assertNoneType(new NFor(null, null, null, null));
        assertNoneType(new NFunctionDef(null, null, null, null, null, null));
        assertNoneType(new NGeneratorExp(null, null));
        assertNoneType(new NGlobal(null));
        assertNoneType(new NIf(null, null, null));
        assertNoneType(new NIfExp(null, null, null));
        assertNoneType(new NImport(null));
View Full Code Here


        NModule m = idx.getAstForFile("deco.py");
        assertNotNull(m);

        NNode obj = m.body.seq.get(0);
        assertTrue(obj instanceof NFunctionDef);
        NFunctionDef f = (NFunctionDef)obj;
        List<NNode> decos = f.getDecoratorList();
        assertNotNull(decos);
        assertEquals(2, decos.size());
        assertTrue(decos.get(0) instanceof NName);

        NName d1 = (NName)decos.get(0);
View Full Code Here

    @Override
    public boolean visit(NName n) {
        NNode parent = n.getParent();
        if (parent instanceof NFunctionDef) {
            NFunctionDef fn = (NFunctionDef)parent;
            if (n == fn.name) {
                addStyle(n, StyleRun.Type.FUNCTION);
            } else if (n == fn.kwargs || n == fn.varargs) {
                addStyle(n, StyleRun.Type.PARAMETER);
            }
View Full Code Here

    }

    @Override
    public Object visitFunctionDef(FunctionDef n) throws Exception {
        arguments args = n.getInternalArgs();
        NFunctionDef fn = new NFunctionDef((NName)convExpr(n.getInternalNameNode()),
                                           convertListExpr(args.getInternalArgs()),
                                           convertListStmt(n.getInternalBody()),
                                           convertListExpr(args.getInternalDefaults()),
                                           (NName)convExpr(args.getInternalVarargName()),
                                           (NName)convExpr(args.getInternalKwargName()),
                                           start(n), stop(n));
        fn.setDecoratorList(convertListExpr(n.getInternalDecorator_list()));
        return fn;
    }
View Full Code Here

TOP

Related Classes of org.python.indexer.ast.NFunctionDef

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.