Examples of NType


Examples of org.python.indexer.types.NType

            if (b != null) {
                fromType.add(b.getType());
            }
        }

        NType toType = resolveExpr(body, funcTable);
        getType().asFuncType().setReturnType(toType);
        return getType();
    }
View Full Code Here

Examples of org.python.indexer.types.NType

        NameBinder param = NameBinder.make(PARAMETER);
        Scope funcTable = getTable();

        for (int i = 0; i < args.size(); i++) {
            NNode arg = args.get(i);
            NType argtype = ((i == 0 && selfBinding != null)
                             ? selfBinding.getType()
                             : getArgType(args, defaults, i));
            param.bind(funcTable, arg, argtype);
            fromType.add(argtype);
        }
View Full Code Here

Examples of org.python.indexer.types.NType

        }
    }

    @Override
    public NType resolve(Scope s) throws Exception {
        NType typeval = new NUnknownType();
        if (exceptionType != null) {
            typeval = resolveExpr(exceptionType, s);
        }
        if (name != null) {
            NameBinder.make().bind(s, name, typeval);
View Full Code Here

Examples of org.python.indexer.types.NType

     * If the module defines an {@code __all__} variable, resolve references
     * to each of the elements.
     */
    private void resolveExportedNames() throws Exception {
        NModuleType mtype = null;
        NType thisType = getType();
        if (thisType.isModuleType()) {
            mtype = thisType.asModuleType();
        } else if (thisType.isUnionType()) {
            for (NType u : thisType.asUnionType().getTypes()) {
                if (u.isModuleType()) {
                    mtype = u.asModuleType();
                    break;
                }
            }
View Full Code Here

Examples of org.python.indexer.types.NType

    protected void bindNames(Scope s) throws Exception {
        Scope container = s.getScopeSymtab();
        setType(new NClassType(name.id, container));

        // If we already defined this class in this scope, don't redefine it.
        NType existing = container.lookupType(name.id);
        if (existing != null && existing.isClassType()) {
            return;
        }

        NameBinder.make(NBinding.Kind.CLASS).bind(container, name, getType());
    }
View Full Code Here

Examples of org.python.indexer.types.NType

    @Override
    public NType resolve(Scope s) throws Exception {
        NClassType thisType = getType().asClassType();
        List<NType> baseTypes = new ArrayList<NType>();
        for (NNode base : bases) {
            NType baseType = resolveExpr(base, s);
            if (baseType.isClassType()) {
                thisType.addSuper(baseType);
            }
            baseTypes.add(baseType);
        }
View Full Code Here

Examples of org.python.indexer.types.NType

        addChildren(values);
    }

    @Override
    public NType resolve(Scope s) throws Exception {
        NType keyType = resolveListAsUnion(keys, s);
        NType valType = resolveListAsUnion(values, s);
        return setType(new NDictType(keyType, valType));
    }
View Full Code Here

Examples of org.python.indexer.types.NType

        name.setType(b.followType());

        // XXX: this seems like a bit of a hack; should at least figure out
        // and document what use cases require it.
        NType nameType = name.getType();
        if (!(nameType.isModuleType() || nameType.isClassType())) {
            nameType.getTable().setPath(b.getQname());
        }

        return b;
    }
View Full Code Here

Examples of org.python.indexer.types.NType

        return b;
    }

    public void bindIter(Scope s, NNode target, NNode iter) throws Exception {
        NType iterType = NNode.resolveExpr(iter, s);

        if (iterType.isListType()) {
            bind(s, target, iterType.asListType().getElementType());
        } else if (iterType.isTupleType()) {
            bind(s, target, iterType.asTupleType().toListType().getElementType());
        } else {
            NBinding ent = iterType.getTable().lookupAttr("__iter__");
            if (ent == null || !ent.getType().isFuncType()) {
                if (!iterType.isUnknownType()) {
                    iter.addWarning("not an iterable type: " + iterType);
                }
                bind(s, target, new NUnknownType());
            } else {
                bind(s, target, ent.getType().asFuncType().getReturnType());
View Full Code Here

Examples of org.python.indexer.types.NType

    }

    @Override
    public NType resolve(Scope s) throws Exception {
        if (op == OpType.AND) {
            NType last = null;
            for (NNode e : values) {
                last = resolveExpr(e, s);
            }
            return setType(last == null ? new NUnknownType() : last);
        }
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.