Examples of NBinding


Examples of org.python.indexer.NBinding

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

     * 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.NBinding

        }
        setType(name.setType(mod));

        if (!isTop() && mod.getFile() != null) {
            Scope parentPkg = getPrevious().getTable();
            NBinding mb = Indexer.idx.moduleTable.lookup(mod.getFile());
            parentPkg.put(name.id, mb);
        }

        resolveExpr(next, s);
        return getType();
View Full Code Here

Examples of org.python.indexer.NBinding

        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

Examples of org.python.indexer.NBinding

     *        either x/y.py or x/y/__init__.py.
     * @param a the "foo [as bar]" component of the import statement
     */
    private void resolveAlias(Scope scope, NModuleType mt, NAlias a) throws Exception {
        // Possibilities 1 & 2:  x/y.py or x/y/__init__.py
        NBinding entry = mt.getTable().lookup(a.name);

        if (entry == null) {
            // Possibility 3:  try looking for x/y/foo.py
            String mqname = qname.toQname() + "." + a.qname.toQname();
            NModuleType mt2 = Indexer.idx.loadModule(mqname);
View Full Code Here

Examples of org.python.indexer.NBinding

        }

        List<String> names = mod.getExportedNames();
        if (!names.isEmpty()) {
            for (String name : names) {
                NBinding nb = mt.getTable().lookupLocal(name);
                if (nb != null) {
                    s.put(name, nb);
                }
            }
        } else {
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.