Package org.python.indexer.types

Examples of org.python.indexer.types.NUnknownType


     * Assign some definite value to the attribute.  Used during the name
     * resolution pass.  This method is called when this node is in the lvalue of
     * an assignment, in which case it is called in lieu of {@link #resolve}.<p>
     */
    public void setAttr(Scope s, NType v) throws Exception {
        setType(new NUnknownType());

        NType targetType = resolveExpr(target, s);
        if (targetType.isUnionType()) {
            targetType = targetType.asUnionType().firstKnownNonNullAlternate();
            if (targetType == null) {
View Full Code Here


        }
    }

    @Override
    public NType resolve(Scope s) throws Exception {
        setType(new NUnknownType());

        NType targetType = resolveExpr(target, s);

        if (targetType.isUnionType()) {
            NType ret = new NUnknownType();
            for (NType tp : targetType.asUnionType().getTypes()) {
                resolveAttributeOnType(tp);
                ret = NUnionType.union(ret, getType());
            }
            setType(attr.setType(ret.follow()));
        } else {
            resolveAttributeOnType(targetType);
        }

        return getType();
View Full Code Here

        // is empty here.  For now, avoid an IndexingException.
        if ("".equals(targetScope.getPath())) {
            return null;
        }

        NType utype = new NUnknownType();
        NBinding b = targetScope.putAttr(attr.id, null, utype, ATTRIBUTE);
        if (b != null) {
            b.setProvisional(true);
            utype.getTable().setPath(b.getQname());
        }
        return b;
    }
View Full Code Here

    static void bindAliases(Scope s, List<NAlias> aliases) throws Exception {
        NameBinder binder = NameBinder.make();
        for (NAlias a : aliases) {
            if (a.aname != null) {
                binder.bind(s, a.aname, new NUnknownType());
            }
        }
    }
View Full Code Here

    }

    protected void bindFunctionParams(Scope funcTable) throws Exception {
        NameBinder param = NameBinder.make(PARAMETER);
        for (NNode a : args) {
            param.bind(funcTable, a, new NUnknownType());
        }
        if (varargs != null) {
            param.bind(funcTable, varargs, new NListType());
        }
        if (kwargs != null) {
View Full Code Here

        }
    }

    static NType getArgType(List<NNode> args, List<NNode> defaults, int argnum) {
        if (defaults == null) {
            return new NUnknownType();
        }
        int firstDefault = args.size() - defaults.size();
        if (firstDefault >= 0 && argnum >= firstDefault) {
            return defaults.get(argnum - firstDefault).getType();
        }
        return new NUnknownType();
    }
View Full Code Here

    }

    @Override
    protected void bindNames(Scope s) throws Exception {
        if (name != null) {
            NameBinder.make().bind(s, name, new NUnknownType());
        }
    }
View Full Code Here

        }
    }

    @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);
        }
        if (body != null) {
            return setType(resolveExpr(body, s));
        } else {
            return setType(new NUnknownType());
        }
    }
View Full Code Here

        Builtins builtins = Indexer.idx.builtins;
        addSpecialAttribute("__bases__", new NTupleType(baseTypes));
        addSpecialAttribute("__name__", builtins.BaseStr);
        addSpecialAttribute("__module__", builtins.BaseStr);
        addSpecialAttribute("__doc__", builtins.BaseStr);
        addSpecialAttribute("__dict__", new NDictType(builtins.BaseStr, new NUnknownType()));

        resolveExpr(body, getTable());
        return getType();
    }
View Full Code Here

        bindNames(s, target, NameBinder.make());
    }

    private void bindNames(Scope s, NNode target, NameBinder binder) throws Exception {
        if (target instanceof NName) {
            binder.bind(s, (NName)target, new NUnknownType());
            return;
        }
        if (target instanceof NSequence) {
            for (NNode n : ((NSequence)target).getElements()) {
                bindNames(s, n, binder);
View Full Code Here

TOP

Related Classes of org.python.indexer.types.NUnknownType

Copyright © 2018 www.massapicom. 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.