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

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


        return catches.toList();
    }


    private boolean isOrContainsError(ProducedType exceptionType) {
        TypeDeclaration declaration = exceptionType.getDeclaration();
        if (declaration instanceof TypeAlias) {
            return isOrContainsError(exceptionType.resolveAliases());
        } else if (declaration instanceof UnionType) {
            for (ProducedType t : declaration.getCaseTypes()) {
                if (isOrContainsError(t)) {
                    return true;
                }
            }
            return false;
        } else if (declaration instanceof IntersectionType) {
            for (ProducedType t : declaration.getSatisfiedTypes()) {
                if (isOrContainsError(t)) {
                    return true;
                }
            }
            return false;
        } else {
            return "java.lang::Error".equals(declaration.getQualifiedNameString());
        }
    }
View Full Code Here


        loadInterfaceInheritedMembers(methodSpecification);
    }

    private void loadSuperclassInheritedMembers(MemberSpecification specification) {
        LinkedHashMap<TypeDeclaration, List<Declaration>> inheritedMembers = new LinkedHashMap<TypeDeclaration, List<Declaration>>();
        TypeDeclaration subclass = klass;
        for (TypeDeclaration superClass : superClasses) {
            List<Declaration> methods = getInheritedMembers(superClass, specification);
            if (methods.isEmpty())
                continue;
            List<Declaration> notRefined = new ArrayList<Declaration>();
            // clean already listed methods (refined in subclasses)
            // done in 2 phases to avoid empty tables
            for (Declaration method : methods) {
                if (subclass.getDirectMember(method.getName(), null, false) == null) {
                    notRefined.add(method);
                }
            }
            if (notRefined.isEmpty())
                continue;
View Full Code Here

    }

    private void loadInterfaceInheritedMembers(MemberSpecification memberSpecification) {
        LinkedHashMap<TypeDeclaration, List<Declaration>> result = new LinkedHashMap<TypeDeclaration, List<Declaration>>();
        for (ProducedType superInterface : superInterfaces) {
            TypeDeclaration decl = superInterface.getDeclaration();
            List<Declaration> members = getInheritedMembers(decl, memberSpecification);
            for (Declaration member : members) {
               
                Declaration refined = member.getRefinedDeclaration();
                if (refined == null
View Full Code Here

        writeTypeParametersConstraints(klass.getTypeParameters());
    }

    private void writeQualifyingType(TypeDeclaration klass) throws IOException {
        if (klass.isClassOrInterfaceMember()) {
            TypeDeclaration container = (TypeDeclaration) klass.getContainer();
            writeQualifyingType(container);
            linkRenderer().to(container).write();
            write(".");
        }
    }   
View Full Code Here

        boolean isNested = false;
        for (String currentDeclName : declNames) {
            currentDecl = resolveDeclaration(currentScope, currentDeclName, isNested);
            if (currentDecl != null) {
                if( isValueWithTypeObject(currentDecl) ) {
                    TypeDeclaration objectType = ((Value)currentDecl).getTypeDeclaration();
                    currentScope = objectType;
                    currentDecl = objectType;
                } else {
                    currentScope = resolveScope(currentDecl);
                }
View Full Code Here

        return true;
    }

    private boolean isValueWithTypeObject(Declaration decl) {
        if (Decl.isValue(decl)) {
            TypeDeclaration typeDeclaration = ((Value) decl).getTypeDeclaration();
            if (typeDeclaration instanceof Class && typeDeclaration.isAnonymous()) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

    }

    private void decompose(ProducedType pt, List<ProducedType> producedTypes) {
        if (!producedTypes.contains(pt)) {
            producedTypes.add(pt);
            TypeDeclaration decl = pt.getDeclaration();
            if (decl instanceof IntersectionType) {
                for (ProducedType satisfiedType : pt.getSatisfiedTypes()) {
                    decompose(satisfiedType, producedTypes);
                }
            } else if (decl instanceof UnionType) {
View Full Code Here

        return modifiers.toString().trim();
    }

    public static List<TypeDeclaration> getAncestors(TypeDeclaration decl) {
        List<TypeDeclaration> ancestors = new ArrayList<TypeDeclaration>();
        TypeDeclaration ancestor = decl.getExtendedTypeDeclaration();
        while (ancestor != null) {
            ancestors.add(ancestor);
            ancestor = ancestor.getExtendedTypeDeclaration();
        }
        return ancestors;
    }
View Full Code Here

        }
        return null;
    }

    private static Declaration findBottomMostRefinedDeclaration(TypedDeclaration d, Queue<TypeDeclaration> queue) {
        TypeDeclaration type = queue.poll();
        if (type != null) {
            if (type != d.getContainer()) {
                Declaration member = type.getDirectMember(d.getName(), null, false);
                if (member != null && member.isActual()) {
                    return member;
                }
            }

            queue.add(type.getExtendedTypeDeclaration());
            queue.addAll(type.getSatisfiedTypeDeclarations());

            return findBottomMostRefinedDeclaration(d, queue);
        }

        return null;
View Full Code Here

    }

    private File getObjectFile(Object modPgkOrDecl) throws IOException {
        final File file;
        if (modPgkOrDecl instanceof TypeDeclaration) {
            TypeDeclaration type = (TypeDeclaration)modPgkOrDecl;
            String filename = getFileName(type);
            file = new File(getFolder(type), filename);
        } else if (modPgkOrDecl instanceof Module) {
            String filename = "index.html";
            file = new File(getApiOutputFolder((Module)modPgkOrDecl), filename);
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.