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

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


        for (Module module : modules) {
            for (Package pkg : getPackages(module)) {
                for (Declaration decl : pkg.getMembers()) {
                    if (decl instanceof Method && decl.isAnnotation() && shouldInclude(decl)) {
                        Method annotationCtor = (Method) decl;
                        TypeDeclaration annotationType = annotationCtor.getTypeDeclaration();
                        List<Method> annotationConstructorList = annotationConstructors.get(annotationType);
                        if (annotationConstructorList == null) {
                            annotationConstructorList = new ArrayList<Method>();
                            annotationConstructors.put(annotationType, annotationConstructorList);
                        }
View Full Code Here


                    modelNodeMap.put(that.getDeclarationModel(), that);
                    super.visit(that);
                }
                public void visit(Tree.ObjectDefinition that) {
                    if( that.getDeclarationModel() != null && that.getDeclarationModel().getTypeDeclaration() != null ) {
                        TypeDeclaration typeDecl = that.getDeclarationModel().getTypeDeclaration();
                        modelUnitMap.put(typeDecl, pu);
                        modelNodeMap.put(typeDecl, that);
                    }
                    super.visit(that);
                }
View Full Code Here

    private boolean isConstantValue(Declaration d) {
        if(Decl.isValue(d)) {
            Value value = (Value) d;
            if( value.isShared() && !value.isVariable() ) {
                Unit unit = value.getUnit();
                TypeDeclaration type = value.getTypeDeclaration();
               
                if (type == unit.getSequentialDeclaration()) {
                    ProducedType elementType = unit.getIteratedType(value.getType());
                    type = elementType.getDeclaration();
                }
View Full Code Here

    public static boolean isObjectValue(TypedDeclaration attr) {
        ProducedType type = attr.getType();
        // Check type because in case of compile errors it can be null
        if (type != null) {
            TypeDeclaration typeDecl = type.getDeclaration();
            return typeDecl.isAnonymous();
        }
        return false;
    }
View Full Code Here

   

   
   
    public static boolean isEnumeratedTypeWithAnonCases(ProducedType parameterType) {
        TypeDeclaration decl = parameterType.getDeclaration();
        if (decl.equals(decl.getUnit().getBooleanDeclaration())) {
            return false;
        }
        if (decl.getCaseTypeDeclarations() == null) {
            return false;
        }
        for (TypeDeclaration td : decl.getCaseTypeDeclarations()) {
            if (!td.isAnonymous()) {
                return false;
            }
        }
        return true;
View Full Code Here

        if (com.redhat.ceylon.compiler.typechecker.analyzer.Util.isBooleanTrue(decl)
                || com.redhat.ceylon.compiler.typechecker.analyzer.Util.isBooleanFalse(decl)) {
            return false;
        }
        if (decl instanceof Value) {
            TypeDeclaration type = ((Value) decl).getType().getDeclaration();
            if (type.isAnonymous()) {
                if (isEnumeratedTypeWithAnonCases(type.getExtendedType())) {
                    return true;
                }
                for (ProducedType s : type.getSatisfiedTypes()) {
                    if (isEnumeratedTypeWithAnonCases(s)) {
                        return true;
                    }
                }
            }
View Full Code Here

    /**
     * Returns true if the given produced type is a type parameter or has type arguments which
     * are type parameters.
     */
    public static boolean containsTypeParameter(ProducedType type) {
        TypeDeclaration declaration = type.getDeclaration();
        if(declaration == null)
            return false;
        if(declaration instanceof TypeParameter)
            return true;
        for(ProducedType pt : type.getTypeArgumentList()){
            if(containsTypeParameter(pt)){
                return true;
            }
        }
        if(declaration instanceof IntersectionType){
            List<ProducedType> types = declaration.getSatisfiedTypes();
            for(int i=0,l=types.size();i<l;i++){
                if(containsTypeParameter(types.get(i)))
                    return true;
            }
            return false;
        }
        if(declaration instanceof UnionType){
            List<ProducedType> types = declaration.getCaseTypes();
            for(int i=0,l=types.size();i<l;i++){
                if(containsTypeParameter(types.get(i)))
                    return true;
            }
            return false;
View Full Code Here

                if(isRaw(target.getQualifyingType())){
                    CodegenUtil.markTypeErased(that);
                }
                // See note in ClassTransformer.makeDelegateToCompanion for a similar test
                else{
                    TypeDeclaration declaration = target.getQualifyingType().getDeclaration();
                    if(needsRawCastForMixinSuperCall(declaration, target.getType()))
                        CodegenUtil.markTypeErased(that);
                }
            }
        }
View Full Code Here

    }
   
    private boolean hasTypeParameterWithConstraintsOutsideScopeResolved(ProducedType type, Scope scope) {
        if(type == null)
            return false;
        TypeDeclaration declaration = type.getDeclaration();
        if(declaration == null)
            return false;
        if(declaration instanceof UnionType){
            UnionType ut = (UnionType) declaration;
            java.util.List<ProducedType> caseTypes = ut.getCaseTypes();
            for(ProducedType pt : caseTypes){
                if(hasTypeParameterWithConstraintsOutsideScopeResolved(pt, scope))
                    return true;
            }
            return false;
        }
        if(declaration instanceof IntersectionType){
            IntersectionType ut = (IntersectionType) declaration;
            java.util.List<ProducedType> satisfiedTypes = ut.getSatisfiedTypes();
            for(ProducedType pt : satisfiedTypes){
                if(hasTypeParameterWithConstraintsOutsideScopeResolved(pt, scope))
                    return true;
            }
            return false;
        }
        if(declaration instanceof TypeParameter){
            // only look at it if it is defined outside our scope
            Scope typeParameterScope = declaration.getContainer();
            while(scope != null){
                if (Decl.equalScopes(scope,  typeParameterScope))
                    return false;
                scope = scope.getContainer();
            }
View Full Code Here

    }

    private boolean isParamTypeLocalToMethod(Parameter parameter,
            ProducedType nonWideningType) {
        Declaration method = parameter.getDeclaration();
        TypeDeclaration paramTypeDecl = nonWideningType.getDeclaration();
        if (paramTypeDecl instanceof TypeParameter
                && Decl.equalScopeDecl(paramTypeDecl.getContainer(), method)) {
            return false;
        }
        Scope scope = paramTypeDecl.getContainer();
        while (scope != null && !(scope instanceof Package)) {
            if (Decl.equalScopeDecl(scope, method)) {
                return true;
            }
            scope = scope.getContainer();
View Full Code Here

TOP

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

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.