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

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


                argumentsType arguments = makeArguments(stack.nodeArity() - 2);
                NameTok nameTok = makeName(NameTok.FunctionName);
                Decorators decs = (Decorators) stack.popNode();
                decoratorsType[] decsexp = decs.exp;
                FunctionDef funcDef = new FunctionDef(nameTok, arguments, body, decsexp, null);
                if (decs.exp.length == 0) {
                    addSpecialsBefore(decs, funcDef);
                }
                addSpecialsAndClearOriginal(suite, funcDef);
                setParentForFuncOrClass(body, funcDef);
View Full Code Here


            if (functionFound != null) {
                int lastReturnedLine = it.getLastReturnedLine();
                NameTok nameTok = createNameTok(functionFound, lastReturnedLine, NameTok.FunctionName, ps);

                if (nameTok != null) {
                    FunctionDef functionDef = createFunctionDef(lastReturnedLine, nameTok,
                            PySelection.getFirstCharPosition(line));

                    if (!addStatement(body, functionDef)) {
                        return body;
                    }
View Full Code Here

    }

    private FunctionDef createFunctionDef(int lastReturnedLine, NameTok nameTok, int matchedCol) {
        argumentsType args = new argumentsType(EMTPY_EXPR_TYPE, null, null, EMTPY_EXPR_TYPE, null, null, null, null,
                null, null);
        FunctionDef functionDef = new FunctionDef(nameTok, args, EMTPY_STMT_TYPE, EMTPY_DECORATORS_TYPE, null);
        functionDef.beginLine = lastReturnedLine + 1;
        functionDef.beginColumn = matchedCol + 1;
        return functionDef;
    }
View Full Code Here

                argumentsType arguments = makeArguments(stack.nodeArity() - 2);
                NameTok nameTok = makeName(NameTok.FunctionName);
                Decorators decs = (Decorators) stack.popNode();
                decoratorsType[] decsexp = decs.exp;
                FunctionDef funcDef = new FunctionDef(nameTok, arguments, body, decsexp, null);
                if (decs.exp.length == 0) {
                    addSpecialsBefore(decs, funcDef);
                }
                addSpecialsAndClearOriginal(suite, funcDef);
                setParentForFuncOrClass(body, funcDef);
View Full Code Here

            if (defNode instanceof ClassDef) {
                ClassDef def = (ClassDef) defNode;
                node = (NameTok) def.name;
            }
            if (defNode instanceof FunctionDef) {
                FunctionDef def = (FunctionDef) defNode;
                node = (NameTok) def.name;
            }
        }
        return node;
    }
View Full Code Here

                    String name = null;
                    if (token instanceof ClassDef) {
                        ClassDef classDefToken = (ClassDef) token;
                        name = NodeUtils.getNameFromNameTok((NameTok) (classDefToken).name);
                    } else if (token instanceof FunctionDef) {
                        FunctionDef functionDefToken = (FunctionDef) token;
                        name = NodeUtils.getNameFromNameTok((NameTok) (functionDefToken).name);
                    } else if (token instanceof Attribute) {
                        Attribute attributeToken = (Attribute) token;
                        name = NodeUtils.getNameFromNameTok((NameTok) (attributeToken).attr);
                    } else if (token instanceof Name) {
View Full Code Here

                    }
                    SimpleNode token = astThis.node;

                    //String name = null;
                    if (token instanceof FunctionDef) {
                        FunctionDef functionDefToken = (FunctionDef) token;
                        if (functionDefToken.decs != null) {
                            for (decoratorsType decorator : functionDefToken.decs) {
                                if (decorator.func instanceof Name) {
                                    Name decoratorFuncName = (Name) decorator.func;
                                    if (decoratorFuncName.id.equals("staticmethod")) {
View Full Code Here

                            for (ItemPointer p : pointers) {
                                Definition definition = p.definition;
                                try {
                                    Object peek = definition.scope.getScopeStack().peek();
                                    if (peek instanceof FunctionDef) {
                                        FunctionDef functionDef = (FunctionDef) peek;
                                        String rep = NodeUtils.getRepresentationString(functionDef);
                                        if (rep != null && rep.equals("__init__")) {
                                            foundInInit = true;
                                            break;
                                        }
View Full Code Here

                    case FIELD:

                        parametersAfterCall = checkFirst(parametersAfterCall, "self");
                        FunctionDefAdapter firstInit = targetClass.getFirstInit();
                        if (firstInit != null) {
                            FunctionDef astNode = firstInit.getASTNode();
                            replacePassStatement = getLastPassFromNode(astNode);

                            //Create the field as the last line in the __init__
                            int nodeLastLine = firstInit.getNodeLastLine() - 1;
                            indent = firstInit.getNodeBodyIndent();
View Full Code Here

                            ImageCache.DECORATION_LOCATION_BOTTOM_RIGHT);
                default:
                    return imageCache.get(UIConstants.CLASS_ICON);
            }
        } else if (token instanceof FunctionDef) {
            FunctionDef functionDefToken = (FunctionDef) token;

            String methodName = NodeUtils.getNameFromNameTok((NameTok) ((FunctionDef) token).name);
            String qualifierIcon = null;
            switch (qualifierFromName(methodName)) {
                case QUALIFIER_PRIVATE:
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.