Search in sources :

Example 6 with ClassType

use of org.yinwang.pysonar.types.ClassType in project pysonar2 by yinwang0.

the class TypeInferencer method bindMethodAttrs.

static void bindMethodAttrs(@NotNull FunType cl) {
    if (cl.table.parent != null) {
        Type cls = cl.table.parent.type;
        if (cls != null && cls instanceof ClassType) {
            addReadOnlyAttr(cl, "im_class", cls, CLASS);
            addReadOnlyAttr(cl, "__class__", cls, CLASS);
            addReadOnlyAttr(cl, "im_self", cls, ATTRIBUTE);
            addReadOnlyAttr(cl, "__self__", cls, ATTRIBUTE);
        }
    }
}
Also used : ClassType(org.yinwang.pysonar.types.ClassType) ListType(org.yinwang.pysonar.types.ListType) DictType(org.yinwang.pysonar.types.DictType) InstanceType(org.yinwang.pysonar.types.InstanceType) Type(org.yinwang.pysonar.types.Type) UnionType(org.yinwang.pysonar.types.UnionType) TupleType(org.yinwang.pysonar.types.TupleType) FunType(org.yinwang.pysonar.types.FunType) ModuleType(org.yinwang.pysonar.types.ModuleType) ClassType(org.yinwang.pysonar.types.ClassType)

Aggregations

ClassType (org.yinwang.pysonar.types.ClassType)6 Type (org.yinwang.pysonar.types.Type)6 UnionType (org.yinwang.pysonar.types.UnionType)6 DictType (org.yinwang.pysonar.types.DictType)5 FunType (org.yinwang.pysonar.types.FunType)5 InstanceType (org.yinwang.pysonar.types.InstanceType)5 ListType (org.yinwang.pysonar.types.ListType)5 ModuleType (org.yinwang.pysonar.types.ModuleType)5 TupleType (org.yinwang.pysonar.types.TupleType)5 NotNull (org.jetbrains.annotations.NotNull)4 ArrayList (java.util.ArrayList)3 State (org.yinwang.pysonar.State)2 TreeSet (java.util.TreeSet)1 Binding (org.yinwang.pysonar.Binding)1 CallStackEntry (org.yinwang.pysonar.CallStackEntry)1