Examples of NUnknownType


Examples of org.python.indexer.types.NUnknownType

                                   xs.get(0).start(),
                                   xs.get(xs.size()-1).end(),
                                   "unpacking non-iterable: " + rvalue);
        }
        for (int i = 0; i < xs.size(); i++) {
            bind(s, xs.get(i), new NUnknownType());
        }
    }
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

            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.NUnknownType

        if (op == OpType.AND) {
            NType last = null;
            for (NNode e : values) {
                last = resolveExpr(e, s);
            }
            return setType(last == null ? new NUnknownType() : last);
        }

        // OR
        return setType(resolveListAsUnion(values, s));
    }
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

        }
    }

    private static NType handleExceptionInResolve(NNode n, Throwable t) {
        Indexer.idx.handleException("Unable to resolve: " + n + " in " + n.getFile(), t);
        return new NUnknownType();
    }
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

        return new NUnknownType();
    }

    public static NType resolveExpr(NNode n, Scope s) {
        if (n == null) {
            return new NUnknownType();
        }
        // This try-catch enables error recovery when there are bugs in
        // the indexer.  Rather than unwinding all the way up to the module
        // level (and failing to load the module), we record an error for this
        // node and continue.
        try {
            NType result = n.resolve(s);
            if (result == null) {
                Indexer.idx.warn(n + " resolved to a null type");
                return n.setType(new NUnknownType());
            }
            return result;
        } catch (IndexingException ix) {
            throw ix;
        } catch (Exception x) {
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

     * return the union of their types.  If {@code nodes} is empty or
     * {@code null}, returns a new {@link NUnknownType}.
     */
    protected NType resolveListAsUnion(List<? extends NNode> nodes, Scope s) {
        if (nodes == null || nodes.isEmpty()) {
            return new NUnknownType();
        }

        NType result = null;
        for (NNode node : nodes) {
            NType nodeType = resolveExpr(node, s);
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

     * node from the defs and add it to the refs.
     */
    private NBinding makeTempBinding(Scope s) {
        Scope scope = s.getScopeSymtab();

        NBinding b = scope.put(id, this, new NUnknownType(), NBinding.Kind.SCOPE);
        setType(b.getType().follow());

        // Update the qname to this point in case we add attributes later.
        // If we don't add attributes, this path extension is harmless/unused.
        getTable().setPath(scope.extendPath(id));
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

            throw new IllegalArgumentException("'id' param cannot be null");
        }
        qname = name = id;
        defs = new ArrayList<Def>(DEF_SET_INITIAL_CAPACITY);
        addDef(def);
        this.type = type == null ? new NUnknownType() : type;
        this.kind = kind == null ? Kind.SCOPE : kind;
    }
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

        // slicing
        if (vt.isUnknownType()) {
            if (st.isListType()) {
                return setType(vt);
            }
            return setType(new NUnknownType());
        }

        if (st.isListType()) {
            NType getslice_type = vt.getTable().lookupTypeAttr("__getslice__");
            if (getslice_type == null) {
                addError("The type can't be sliced: " + vt);
                return setType(new NUnknownType());
            }
            if (!getslice_type.isFuncType()) {
                addError("The type's __getslice__ method is not a function: "
                                       + getslice_type);
                return setType(new NUnknownType());
            }
            return setType(getslice_type.asFuncType().getReturnType().follow());
        }

        // subscription
View Full Code Here

Examples of org.python.indexer.types.NUnknownType

    }

    private NType get__getitem__type(NType gt, NType vt) {
        if (gt == null) {
            addError("indexing type without __getitem__ method: " + vt);
            return new NUnknownType();
        }
        if (!gt.isFuncType()) {
            addError("The type's __getitem__ method is not a function: " + gt);
            return new NUnknownType();
        }
        return gt.asFuncType().getReturnType().follow();
    }
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.