Package com.redhat.ceylon.compiler.typechecker.model

Examples of com.redhat.ceylon.compiler.typechecker.model.Class


    }

    @Override
    public void visit(Tree.ObjectArgument that) {
        Value value = that.getDeclarationModel();
        Class anonymousClass =
                (Class) value.getType().getDeclaration();
        validateMemberRefinement(that, anonymousClass);
        super.visit(that);
        //an object definition is always concrete
        List<Type> orderedTypes =
View Full Code Here


                that.getAnonymousClass());
    }
   
    @Override public void visit(Tree.ClassDeclaration that) {
        super.visit(that);
        Class alias = that.getDeclarationModel();
        Class c = alias.getExtendedTypeDeclaration();
        if (c!=null) {
            if (c.isAbstract()) {
                if (!alias.isFormal() && !alias.isAbstract()) {
                    that.addError("alias of abstract class must be annotated abstract", 310);
                }
            }
            if (c.isAbstraction()) {
                that.addError("class alias may not alias overloaded class");
            }
            else {
                //TODO: all this can be removed once the backend
                //      implements full support for the new class
                //      alias stuff
                ProducedType at = alias.getExtendedType();
                ParameterList cpl = c.getParameterList();
                ParameterList apl = alias.getParameterList();
                if (cpl!=null && apl!=null) {
                    int cps = cpl.getParameters().size();
                    int aps = apl.getParameters().size();
                    if (cps!=aps) {
View Full Code Here

    }
   
   void visitExtendedTypePrimary(Tree.ExtendedTypeExpression that) {
        Declaration dec = that.getDeclaration();
        if (dec instanceof Class) {
            Class c = (Class) dec;
            if (c.isAbstraction()) {
                //if the constructor is overloaded
                //resolve the right overloaded version
                Declaration result =
                        findMatchingOverloadedClass(c,
                                that.getSignature(),
View Full Code Here

        }
    }

    private ProducedType defaultType() {
        TypeDeclaration ut = new UnknownType(unit);
        Class ad = unit.getAnythingDeclaration();
        if (ad!=null) {
            ut.setExtendedType(ad.getType());
        }
        return ut.getType();
    }
View Full Code Here

    }

    @Override
    public void visit(Tree.AnyClass that) {
        super.visit(that);
        Class c = that.getDeclarationModel();
        if (that.getParameterList()!=null) {
            checkParameterVisibility(c, that.getParameterList());
        }
    }
View Full Code Here

    @Override
    public void visit(Tree.InterfaceDefinition that) {
        Interface id = that.getDeclarationModel();
        id.setExtendedType(null);
        id.getSatisfiedTypes().clear();
        Class od = unit.getObjectDeclaration();
        if (od!=null) {
            id.setExtendedType(od.getType());
        }
        super.visit(that);
    }
View Full Code Here

    @Override
    public void visit(Tree.TypeParameterDeclaration that) {
        TypeParameter tpd = that.getDeclarationModel();
        tpd.setExtendedType(null);
        tpd.getSatisfiedTypes().clear();
        Class vd = unit.getAnythingDeclaration();
        if (vd!=null) {
            tpd.setExtendedType(vd.getType());
        }
        super.visit(that);
        Tree.TypeSpecifier ts = that.getTypeSpecifier();
        if (ts!=null) {
            Tree.StaticType type = ts.getType();
View Full Code Here

        }
    }
   
    @Override
    public void visit(Tree.ClassDeclaration that) {
        Class td = that.getDeclarationModel();
        td.setExtendedType(null);
        super.visit(that);
        Tree.ClassSpecifier cs = that.getClassSpecifier();
        if (cs==null) {
            that.addError("missing class body or aliased class reference");
        }
        else {
            if (that.getExtendedType()!=null) {
                that.getExtendedType().addError("class alias may not extend a type");
            }
            if (that.getSatisfiedTypes()!=null) {
                that.getSatisfiedTypes().addError("class alias may not satisfy a type");
            }
            if (that.getCaseTypes()!=null) {
                that.addError("class alias may not have cases or a self type");
            }
            Tree.SimpleType ct = cs.getType();
            if (ct==null) {
//                that.addError("malformed aliased class");
            }
            else if (!(ct instanceof Tree.StaticType)) {
                cs.addError("aliased type must be a class");
            }
            /*else if (ct instanceof Tree.QualifiedType) {
                cs.addError("aliased class may not be a qualified type");
            }*/
            else {
                ProducedType type = ct.getTypeModel();
                if (type!=null) {
                    /*if (type.containsTypeAliases()) {
                        et.addError("aliased type involves type aliases: " +
                                type.getProducedTypeName());
                    }
                    else*/ if (type.getDeclaration() instanceof Class) {
                        that.getDeclarationModel().setExtendedType(type);
                    }
                    else {
                        ct.addError("not a class: '" +
                                type.getDeclaration().getName(unit) + "'");
                    }
                    TypeDeclaration etd = ct.getDeclarationModel();
                    if (etd==td) {
                        //TODO: handle indirect circularities!
                        ct.addError("directly aliases itself: '" + td.getName() + "'");
                        return;
                    }
                }
            }
        }
View Full Code Here

        });
    }
   
    @Override
    public void visit(Tree.ClassDefinition that) {
        Class c = new Class();
        if (!unit.getPackage().getQualifiedNameString().equals("ceylon.language") ||
                !"Anything".equalsIgnoreCase(name(that.getIdentifier()))) {
            defaultExtendedToBasic(c);
        }
        that.setDeclarationModel(c);
View Full Code Here

        super.visit(that);
    }
   
    @Override
    public void visit(Tree.ClassDeclaration that) {
        Class c = new ClassAlias();
        that.setDeclarationModel(c);
        super.visit(that);
    }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.typechecker.model.Class

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.