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

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


        AnnotationMirror annotation = annotatedMirror.getAnnotation(CEYLON_LOCAL_DECLARATIONS_ANNOTATION);
        if(annotation == null)
            return;
        List<String> values = getAnnotationStringValues(annotation, "value");
        String parentClassName = classContainerMirror.getQualifiedName();
        Package pkg = Decl.getPackageContainer(container);
        Module module = pkg.getModule();
        for(String scope : values){
            // assemble the name with the parent
            String name;
            if(scope.startsWith("::")){
                // interface pulled to toplevel
                name = pkg.getNameAsString() + "." + scope.substring(2);
            }else{
                name = parentClassName;
                name += "$" + scope;
            }
            Declaration innerDecl = convertToDeclaration(module, name, DeclarationType.TYPE);
View Full Code Here


        List<Package> packages = module.getPackages();
        if(packages.isEmpty()){
            System.err.println("No package for module "+module.getNameAsString());
            return null;
        }
        Package pkg = packages.get(0);
        if(pkg instanceof LazyPackage == false){
            System.err.println("No lazy package for module "+module.getNameAsString());
            return null;
        }
        Unit unit = getCompiledUnit((LazyPackage) pkg, null);
View Full Code Here

                if(typeParameter != null)
                    return typeParameter;
            }
            if(!isBootstrap || !name.startsWith(CEYLON_LANGUAGE)) {
                if(scope != null && pkgName != null){
                    Package containingPackage = Decl.getPackageContainer(scope);
                    Package pkg = containingPackage.getModule().getPackage(pkgName);
                    String relativeName = null;
                    String unquotedName = name.replace("$", "");
                    if(!pkgName.isEmpty()){
                        if(unquotedName.startsWith(pkgName+"."))
                            relativeName = unquotedName.substring(pkgName.length()+1);
                        // else we don't try it's not in this package
                    }else
                        relativeName = unquotedName;
                    if(relativeName != null && pkg != null){
                        Declaration declaration = pkg.getDirectMember(relativeName, null, false);
                        // if we get a value, we want its type
                        if(Decl.isValue(declaration)
                                && ((Value)declaration).getTypeDeclaration().getName().equals(relativeName))
                            declaration = ((Value)declaration).getTypeDeclaration();
                        if(declaration != null)
View Full Code Here

        // Nothing is a special case with no real decl
        if(name.equals("ceylon.language.Nothing"))
            return typeFactory.getNothingDeclaration();

        // find the right package
        Package pkg = languageModule.getDirectPackage(pkgName);
        if(pkg != null){
            Declaration member = pkg.getDirectMember(simpleName, null, false);
            // if we get a value, we want its type
            if(Decl.isValue(member)
                    && ((Value)member).getTypeDeclaration().getName().equals(simpleName)){
                member = ((Value)member).getTypeDeclaration();
            }
View Full Code Here

    private int inspectForStats(Map<String,Declaration> cache, Map<Package, Stats> loadedByPackage){
        int loaded = 0;
        for(Declaration decl : cache.values()){
            if(decl instanceof LazyElement){
                Package pkg = getPackage(decl);
                if(pkg == null){
                    logVerbose("[Model loader stats: declaration "+decl.getName()+" has no package. Skipping.]");
                    continue;
                }
                Stats stats = loadedByPackage.get(pkg);
View Full Code Here

     * the wrong default package and fix it before we start parsing anything.
     */
    public void fixDefaultPackage()  {
        synchronized(getLock()){
            Module defaultModule = modules.getDefaultModule();
            Package defaultPackage = defaultModule.getDirectPackage("");
            if(defaultPackage instanceof LazyPackage == false){
                LazyPackage newPkg = findOrCreateModulelessPackage("");
                List<Package> defaultModulePackages = defaultModule.getPackages();
                if(defaultModulePackages.size() != 1)
                    throw new RuntimeException("Assertion failed: default module has more than the default package: "+defaultModulePackages.size());
                defaultModulePackages.clear();
                defaultModulePackages.add(newPkg);
                newPkg.setModule(defaultModule);
                defaultPackage.setModule(null);
            }
        }
    }
View Full Code Here

    private void checkNativeExistence(Node node, Declaration model){
        if(model == null)
            return;
        if(!Decl.isToplevel(model) || !Decl.isNative(model))
            return;
        Package pkg = Decl.getPackage(model);
        if(pkg == null)
            return;
        String pkgName = Util.quoteJavaKeywords(pkg.getNameAsString());
        String qualifiedName = Naming.toplevelClassName(pkgName, model);
        ClassMirror classMirror = loader.lookupClassMirror(pkg.getModule(), qualifiedName);
        if(classMirror == null)
            node.addError("native declaration not found");
    }
View Full Code Here

            makeClass("d");
            makeClass("e");
            makeClass("f");
            Class t2 = makeParameterisedClass("t2");
            makeParameterisedClass("t2", t2);
            Package otherPkg = new Package();
            otherPkg.setName(Arrays.asList("pkg"));
            makeClass("a", otherPkg);
            Class b = makeClass("b", otherPkg);
            makeClass("c", b);
        }
View Full Code Here

        }
    }
   
    boolean isJavaEnumType(ProducedType type) {
        Module jdkBaseModule = loader().getJDKBaseModule();
        Package javaLang = jdkBaseModule.getPackage("java.lang");
        TypeDeclaration enumDecl = (TypeDeclaration)javaLang.getDirectMember("Enum", null, false);
        if (type.getDeclaration().isAnonymous()) {
            type = type.getDeclaration().getExtendedType();
        }
        return type.isSubtypeOf(enumDecl.getProducedType(null, Collections.singletonList(type)));
    }
View Full Code Here

    }

    public JCTree transform(Tree.PackageLiteral expr) {
        at(expr);
       
        Package pkg = (Package) expr.getImportPath().getModel();
        return makePackageLiteralCall(pkg);
    }
View Full Code Here

TOP

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

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.