Package org.python.indexer

Examples of org.python.indexer.Scope.lookup()


        NModuleType module = (NModuleType)idx.moduleTable.lookupType(abspath(file));
        Scope mtable = module.getTable();
        assertTrue(mtable.lookupType("MyClass").isClassType());
        assertTrue(mtable.lookupType("MyClassNoDoc").isClassType());
        assertTrue(mtable.lookupType("MyClass").getTable().getParent() == mtable);
        assertEquals(NBinding.Kind.CLASS, mtable.lookup("MyClass").getKind());
        Scope t = mtable.lookupType("MyClass").getTable();
        assertTrue(t.lookupType("__bases__").isTupleType());
        assertTrue(t.lookupType("__dict__").isDictType());
        assertEquals(idx.builtins.BaseStr, t.lookupType("__name__"));
        assertEquals(idx.builtins.BaseStr, t.lookupType("__module__"));
View Full Code Here


        assertEquals("classtype_builtins.MyClass.__init__", method.getQname());

        NType ftype = mtable.lookupType("MyClass").getTable().lookupType("__init__");
        assertTrue(ftype.isFuncType());

        NBinding c = mtable.lookup("MyClass");
        for (String special : new String[]{"im_class", "__class__", "im_self", "__self__"}) {
            NBinding attr = ftype.getTable().lookup(special);
            assertNotNull("missing binding for " + special, attr);
            assertEquals(c.getType(), attr.getType());
        }
View Full Code Here

    public NType resolve(Scope outer) throws Exception {
        resolveList(defaults, outer);
        resolveList(decoratorList, outer);

        Scope funcTable = getTable();
        NBinding selfBinding = funcTable.lookup("__self__");
        if (selfBinding != null && !selfBinding.getType().isClassType()) {
            selfBinding = null;
        }

        if (selfBinding != null) {
View Full Code Here

        for (NName name : names) {
            if (s.isGlobalName(name.id)) {
                continue// already bound by this (or another) global stmt
            }
            s.addGlobalName(name.id);
            NBinding b = moduleTable.lookup(name);
            if (b == null) {
                b = moduleTable.put(name.id, null, new NUnknownType(), NBinding.Kind.SCOPE);
            }
            Indexer.idx.putLocation(name, b);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.