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

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


            addErrorToModule(packageStack.peekLast().getName(), error.toString());
        }
    }

    private void createPackageAndAddToModule(String path) {
        final Package lastPkg = packageStack.peekLast();
        List<String> parentName = lastPkg.getName();
        final ArrayList<String> name = new ArrayList<String>(parentName.size() + 1);
        name.addAll(parentName);
        name.add(path);
       
        Package pkg = createPackage(formatPath(name),
                currentModule != null ? currentModule : modules.getDefaultModule());
        packageStack.addLast(pkg);
    }
View Full Code Here


        }
    }
   
    @Override
    public void visit(Tree.Import that) {
        Package importedPackage = getPackage(that.getImportPath());
        if (importedPackage!=null) {
            that.getImportPath().setModel(importedPackage);
            Tree.ImportMemberOrTypeList imtl = that.getImportMemberOrTypeList();
            if (imtl!=null) {
                ImportList il = imtl.getImportList();
View Full Code Here

   
    public static Module getModule(Tree.ImportPath path) {
        if (path!=null && !path.getIdentifiers().isEmpty()) {
            String nameToImport = formatPath(path.getIdentifiers());
            Module module = path.getUnit().getPackage().getModule();
            Package pkg = module.getPackage(nameToImport);
            if (pkg != null) {
                Module mod = pkg.getModule();
                if (!pkg.getNameAsString().equals(mod.getNameAsString())) {
                    path.addError("not a module: '" + nameToImport + "'");
                    return null;
                }
                if (mod.equals(module)) {
                    return mod;
View Full Code Here

   
    public static Package getPackage(Tree.ImportPath path) {
        if (path!=null && !path.getIdentifiers().isEmpty()) {
            String nameToImport = formatPath(path.getIdentifiers());
            Module module = path.getUnit().getPackage().getModule();
            Package pkg = module.getPackage(nameToImport);
            if (pkg != null) {
                if (pkg.getModule().equals(module)) {
                    return pkg;
                }
                if (!pkg.isShared()) {
                    path.addError("imported package is not shared: '" +
                            nameToImport + "'");
                }
//                if (module.isDefault() &&
//                        !pkg.getModule().isDefault() &&
//                        !pkg.getModule().getNameAsString()
//                            .equals(Module.LANGUAGE_MODULE_NAME)) {
//                    path.addError("package belongs to a module and may not be imported by default module: " +
//                            nameToImport);
//                }
                //check that the package really does belong to
                //an imported module, to work around bug where
                //default package thinks it can see stuff in
                //all modules in the same source dir
                Set<Module> visited = new HashSet<Module>();
                for (ModuleImport mi: module.getImports()) {
                    if (findModuleInTransitiveImports(mi.getModule(),
                            pkg.getModule(), visited)) {
                        return pkg;
                    }
                }
            }
            String help;
View Full Code Here

            ClassSymbol c = reader.loadClass(name);
            if (!isAccessible(env, c)) return new AccessError(c);
            if (modelLoader != null && !sourceLanguage.isCeylon()) {
                // Check if the class is accessible according to Ceylon's access rules
                String scopePackageName = pkgSymbol(env.info.scope.owner).toString();
                Package scopePackage = modelLoader.findPackage(scopePackageName);
                // Don't check if we failed to find it
                if(scopePackage != null){
                    Module scopeModule = scopePackage.getModule();
                    // Ugly special case where we skip the test when we're compiling the language module itself
                    if (scopeModule != modelLoader.getLanguageModule()) {
                        String nameString = name.toString();
                        String importedPackageName = modelLoader.getPackageNameForQualifiedClassName(pkgName(nameString), nameString);
                        Package importedPackage = scopeModule.getPackage(importedPackageName);
                        // Don't check if we failed to find it
                        if(importedPackage == null){
                            return new ImportError(c, scopeModule);
                        }
                    }
View Full Code Here

       
        writeFooter();
    }

    private void writeSubNavBar() throws IOException {
        Package pkg = tool.getPackage(klass);
       
        open("div class='sub-navbar'");
       
        writeLinkSourceCode(klass);
       
View Full Code Here

           
            if (decl == null && declName.equals("Nothing") && scope.getQualifiedNameString().equals(AbstractModelLoader.CEYLON_LANGUAGE)) {
                decl = new NothingType(((Package) scope).getUnit());
            }
        } else {
            Package pkg = ceylonDocTool.getCurrentModule().getPackage(AbstractModelLoader.CEYLON_LANGUAGE);
            if (pkg != null) {
                decl = resolveDeclaration(pkg, declName, isNested);
            }
        }
View Full Code Here

            url = getExternalModuleUrl((Module)to);
            if (url != null) {
                url += "index.html";
            }
        } else if (to instanceof Package) {
            Package pkg = (Package)to;
            url = getExternalModuleUrl(pkg.getModule());
            if (url != null) {
                url += buildPackageUrlPath(pkg);
                url += "index.html";
            }
        } else if (to instanceof ClassOrInterface) {
            ClassOrInterface klass = (ClassOrInterface) to;
            Package pkg = getPackage(klass);
            url = getExternalModuleUrl(pkg.getModule());
            if (url != null) {
                url += buildPackageUrlPath(pkg);
                url += ceylonDocTool.getFileName(klass);
            }
        }
View Full Code Here

        }
    }

    private void copySourceFiles() throws FileNotFoundException, IOException {
        for (PhasedUnit pu : phasedUnits) {
            Package pkg = pu.getUnit().getPackage();
            if (!shouldInclude(pkg)) {
                continue;
            }

            File file = new File(getFolder(pu.getPackage()), pu.getUnitFile().getName()+".html");
View Full Code Here

                icons.add("icon-decoration-annotation");
            }
        }

        if (obj instanceof Package) {
            Package pkg = (Package) obj;

            icons.add("icon-package");
            if (!pkg.isShared()) {
                icons.add("icon-decoration-local");
            }
        }
       
        if (obj instanceof ModuleImport) {
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.