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

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


                }
                if (hasParams) {
                    gen.out(",a:");
                    printTypeArguments(node, pt.getTypeArguments(), gen, skipSelfDecl, pt.getVarianceOverrides());
                }
                SiteVariance siteVariance = overrides == null ? null : overrides.get(e.getKey());
                if (siteVariance != null) {
                    gen.out(",", MetamodelGenerator.KEY_US_VARIANCE, ":");
                    if (siteVariance == SiteVariance.IN) {
                        gen.out("'in'");
                    } else {
View Full Code Here


            final Iterator<TypeParameter> typeParameters = usv == null || usv.isEmpty() ?
                    null : pt.getDeclaration().getTypeParameters().iterator();
            for (ProducedType targ : pt.getTypeArgumentList()) {
                final Map<String, Object> tpmap = typeParameterMap(targ, from);
                final TypeParameter typeParam = typeParameters == null ? null : typeParameters.next();
                final SiteVariance variance = typeParam == null ? null : usv.get(typeParam);
                if (variance != null) {
                    tpmap.put(MetamodelGenerator.KEY_US_VARIANCE, variance.ordinal());
                }
                list.add(tpmap);
            }
            container.put(KEY_TYPE_PARAMS, list);
        }
View Full Code Here

                    if(i < typeParameters.size())
                        typeParameter = typeParameters.get(i);
                    ProducedType producedTypeArgument = null;
                    // do we have a type argument?
                    TypeMirror typeArgument = null;
                    SiteVariance siteVariance = null;
                    if(hasTypeArguments){
                        typeArgument = javacTypeArguments.get(i);
                        // if a single type argument is a wildcard and we are in a covariant location, we erase to Object
                        if(typeArgument.getKind() == TypeKind.WILDCARD){
                           
View Full Code Here

            Map<TypeParameter, SiteVariance> varianceOverrides = pt.getVarianceOverrides();
            if(!varianceOverrides.isEmpty()){
                // we need to pass them as second argument then, in an array
                ListBuffer<JCExpression> varianceElements = new ListBuffer<JCExpression>();
                for(TypeParameter typeParameter : declaration.getTypeParameters()){
                    SiteVariance useSiteVariance = varianceOverrides.get(typeParameter);
                    String selector;
                    if(useSiteVariance != null){
                        switch(useSiteVariance){
                        case IN:
                            selector = "IN";
View Full Code Here

            // set the use-site variance if required, now that we know the TypeParameter declarations
            if(!part.getVariance().isEmpty()){
                List<TypeParameter> tps = newTypeDeclaration.getTypeParameters();
                List<SiteVariance> variance = part.getVariance();
                for(int i=0, l1=tps.size(), l2=variance.size() ; i<l1 && i<l2 ; i++){
                    SiteVariance siteVariance = variance.get(i);
                    if(siteVariance != null){
                        ret.setVariance(tps.get(i), siteVariance);
                    }
                }
            }
View Full Code Here

    /*
     * variance: [in |out ]?
     */
    private void parseTypeArgumentVariance(Part type) {
        SiteVariance variance = null;
        if(lexer.lookingAt(TypeLexer.OUT)){
            variance = SiteVariance.OUT;
            lexer.eat();
        }else if(lexer.lookingAt(TypeLexer.IN)){
            variance = SiteVariance.IN;
View Full Code Here

TOP

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

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.