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

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


            entryPointCorrect = true;

            if (node.func instanceof Attribute) {
                List<String> c = StringUtils.dotSplit(methodCall);

                Attribute func = (Attribute) node.func;
                if (((NameTok) func.attr).id.equals(c.get(1))) {

                    if (func.value instanceof Name) {
                        Name name = (Name) func.value;
                        if (name.id.equals(c.get(0))) {
View Full Code Here


            SourceToken s = (SourceToken) token;
            SimpleNode ast = s.getAst();

            String searchFor = FullRepIterable.getLastPart(tokToCheck);
            while (ast instanceof Attribute) {
                Attribute a = (Attribute) ast;

                if (((NameTok) a.attr).id.equals(searchFor)) {
                    return new SourceToken(a.attr, searchFor, "", "", token.getParentPackage());

                } else if (a.value.toString().equals(searchFor)) {
View Full Code Here

        assertEquals("m1", ((NameTok) funcDef.name).id);

        assertNull(funcDef.body[1]);
        Assign assign = (Assign) funcDef.body[0];
        assertEquals(1, assign.targets.length);
        Attribute attribute = (Attribute) assign.targets[0];
        NameTok attr = (NameTok) attribute.attr;
        assertEquals("ATTRIBUTE", attr.id.toString());
    }
View Full Code Here

        assertEquals("m1", ((NameTok) funcDef.name).id);

        for (int i = 0; i < 3; i++) {
            Assign assign = (Assign) funcDef.body[i];
            assertEquals(1, assign.targets.length);
            Attribute attribute = (Attribute) assign.targets[0];
            NameTok attr = (NameTok) attribute.attr;
            assertEquals("ATTRIBUTE" + i, attr.id.toString());
        }
        assertNull(funcDef.body[3]);
    }
View Full Code Here

    }

    private stmtType[] createSetterBody(String attributeName) {
        Name self = new Name("self", Name.Load, true);
        NameTok name = new NameTok(nodeHelper.getPrivateAttr(attributeName), NameTok.Attrib);
        Attribute attribute = new Attribute(self, name, Attribute.Store);

        Name value = new Name("value", Name.Load, false);
        Assign assign = new Assign(new exprType[] { attribute }, value);

        return new stmtType[] { assign };
View Full Code Here

        List<String> splitted = StringUtils.split(attribute, '.');
        if (splitted.size() <= 1) {
            throw new RuntimeException("Cannot create attribute without dot access.");
        }
        if (splitted.size() == 2) {
            return new Attribute(new Name(splitted.get(0), Name.Load, false), new NameTok(splitted.get(1),
                    NameTok.Attrib), Attribute.Load);
        }
        //>2
        return new Attribute(createAttribute(FullRepIterable.getWithoutLastPart(attribute)), new NameTok(
                splitted.get(splitted.size() - 1), NameTok.Attrib), Attribute.Load);

    }
View Full Code Here

            //]

            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 {
View Full Code Here

                Tuple<SimpleNode, Throwable> tup = parseILegalDocSuccessfully(s);
                Module m = (Module) tup.o1;
                Assign assign = (Assign) m.body[0];
                assertNotNull(assign);
                Expr expr = (Expr) m.body[1];
                Attribute attr = (Attribute) expr.value;
                assertEquals("a.!<MissingName>!", NodeUtils.getFullRepresentationString(attr));
                return true;
            }
        });
    }
View Full Code Here

TOP

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

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.