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

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


    }

    @Override public void visit(Tree.ClassDefinition that) {
        Tree.Type rt =
                beginReturnScope(new Tree.VoidModifier(that.getToken()));
        Declaration od =
                beginReturnDeclaration(that.getDeclarationModel());
        super.visit(that);
        endReturnDeclaration(od);
        endReturnScope(rt, null);
        validateEnumeratedSupertypes(that,
View Full Code Here


                that.getDeclarationModel());
    }

    @Override public void visit(Tree.InterfaceDefinition that) {
        Tree.Type rt = beginReturnScope(null);
        Declaration od =
                beginReturnDeclaration(that.getDeclarationModel());
        super.visit(that);
        endReturnDeclaration(od);
        endReturnScope(rt, null);
        validateEnumeratedSupertypes(that,
View Full Code Here

    }

    @Override public void visit(Tree.ObjectDefinition that) {
        Tree.Type rt =
                beginReturnScope(new Tree.VoidModifier(that.getToken()));
        Declaration od =
                beginReturnDeclaration(that.getDeclarationModel());
        super.visit(that);
        endReturnDeclaration(od);
        endReturnScope(rt, null);
        validateEnumeratedSupertypes(that,
View Full Code Here

    }

    @Override public void visit(Tree.ObjectArgument that) {
        Tree.Type rt =
                beginReturnScope(new Tree.VoidModifier(that.getToken()));
        Declaration od =
                beginReturnDeclaration(that.getDeclarationModel());
        super.visit(that);
        endReturnDeclaration(od);
        endReturnScope(rt, null);
        validateEnumeratedSupertypes(that,
View Full Code Here

        if (e!=null && param!=null) {
            MethodOrValue p = param.getModel();
            if (p!=null) {
                Tree.Term term = e.getTerm();
                if (term instanceof Tree.BaseMemberExpression) {
                    Declaration d =
                            ((Tree.BaseMemberExpression) term).getDeclaration();
                    if (d!=null && !d.equals(p)) {
                        e.addUnsupportedError("argument must be a parameter reference to " +
                                p.getName());
                    }
                }
                else {
View Full Code Here

            Tree.PositionalArgumentList pal) {
        Tree.Term term = unwrapExpressionUntilTerm(p);
        if (term instanceof Tree.MemberOrTypeExpression) {
            Tree.MemberOrTypeExpression mte =
                    (Tree.MemberOrTypeExpression) term;
            Declaration dec = mte.getDeclaration();
            if (dec instanceof Functional) {
                inferParameterTypesDirectly(dec, pal, mte);
            }
            else if (dec instanceof Value) {
                ProducedType pt = ((Value) dec).getType();
View Full Code Here

            Tree.NamedArgumentList nal) {
        Tree.Term term = unwrapExpressionUntilTerm(p);
        if (term instanceof Tree.MemberOrTypeExpression) {
            Tree.MemberOrTypeExpression mte =
                    (Tree.MemberOrTypeExpression) term;
            Declaration dec = mte.getDeclaration();
            if (dec instanceof Functional) {
                inferParameterTypesDirectly(dec, nal, mte);
            }
        }
    }
View Full Code Here

    }
   
    private List<ProducedType> inferFunctionRefTypeArgs(
            Tree.StaticMemberOrTypeExpression smte) {
        TypeArguments typeArguments = smte.getTypeArguments();
        Declaration dec = smte.getDeclaration();
        if (typeArguments instanceof Tree.InferredTypeArguments &&
                dec instanceof Generic &&
                !((Generic) dec).getTypeParameters().isEmpty()) {
            ProducedTypedReference param = smte.getTargetParameter();
            ProducedType paramType = smte.getParameterType();
            if (paramType==null && param!=null) {
                paramType = param.getFullType();
            }
            ProducedReference arg = getProducedReference(smte);
            if (!smte.getStaticMethodReferencePrimary() &&
                    dec instanceof Functional &&
                    param!=null) {
                Functional fun = (Functional) dec;
                List<ParameterList> apls = fun.getParameterLists();
                Declaration pdec = param.getDeclaration();
                if (pdec instanceof Functional) {
                    Functional pfun = (Functional) pdec;
                    List<ParameterList> ppls = pfun.getParameterLists();
                    if (apls.isEmpty() || ppls.isEmpty()) {
                        return null; //TODO: to give a nicer error
View Full Code Here

            qt = qte.getPrimary().getTypeModel();
        }
        else {
            qt = null;
        }
        Declaration dec = smte.getDeclaration();
        if (smte.getStaticMethodReferencePrimary()) {
            //TODO: why this special case, exactly?
            return ((TypeDeclaration) dec).getType();
        }
        else {
            return dec.getProducedReference(qt,
                    Collections.<ProducedType>emptyList());
        }
    }
View Full Code Here

            mte.setEllipsis(hasSpreadArgument(args));
        }
    }
   
    private void checkSuperInvocation(Tree.MemberOrTypeExpression qmte) {
        Declaration member = qmte.getDeclaration();
        if (member!=null) {
            if (member.isFormal() && !inExtendsClause) {
                qmte.addError("supertype member is declared formal: '" + member.getName() +
                        "' of '" + ((TypeDeclaration) member.getContainer()).getName() + "'");
            }
            else {
                ClassOrInterface ci = getContainingClassOrInterface(qmte.getScope());
                if (ci!=null) {
                    Declaration etm = ci.getExtendedTypeDeclaration()
                            .getMember(member.getName(), null, false);
                    if (etm!=null && !etm.equals(member) && etm.refines(member)) {
                        qmte.addError("inherited member is refined by intervening superclass: '" +
                                ((TypeDeclaration) etm.getContainer()).getName() +
                                "' refines '" + member.getName() + "' declared by '" +
                                ((TypeDeclaration) member.getContainer()).getName() + "'");
                    }
                    for (TypeDeclaration td: ci.getSatisfiedTypeDeclarations()) {
                        Declaration stm = td.getMember(member.getName(), null, false);
                        if (stm!=null && !stm.equals(member) && stm.refines(member)) {
                            qmte.addError("inherited member is refined by intervening superinterface: '" +
                                    ((TypeDeclaration) stm.getContainer()).getName() +
                                    "' refines '" + member.getName() + "' declared by '" +
                                    ((TypeDeclaration) member.getContainer()).getName() + "'");
                        }
                    }
                }
View Full Code Here

TOP

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

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.