Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.ModuleTypeInfo


    public final Module findModule (ModuleName moduleName) {
        if (this.getName().equals (moduleName)) {
            return this;
        }
       
        ModuleTypeInfo foundTypeInfo = getModuleTypeInfo().getDependeeModuleTypeInfo(moduleName);
        return foundTypeInfo == null ? null : foundTypeInfo.getModule();
    }
View Full Code Here


        s.startRecord(ModuleSerializationTags.MODULE_IMPORTS, importSerializationSchema);
        s.writeModuleName(getName());
        int nImports = moduleTypeInfo.getNImportedModules();
        s.writeInt(nImports);
        for (int i = 0; i < nImports; ++i) {
            ModuleTypeInfo mti = moduleTypeInfo.getNthImportedModule(i);
            s.writeModuleName(mti.getModuleName());
        }
        s.endRecord();
       
    }
View Full Code Here

     * @param names - The set of dependee module names thus far
     * @return Set of String, all direct and indirect dependee module names.
     */
    private final Set<ModuleName> getDependeeModuleNames (Set<ModuleName> names) {
        for (int i = 0, n = getModuleTypeInfo().getNImportedModules(); i < n; ++i) {
            ModuleTypeInfo importedMTI = getModuleTypeInfo().getNthImportedModule(i);
            if (!names.contains(importedMTI.getModuleName())) {
                names.add(importedMTI.getModuleName());
                importedMTI.getModule().getDependeeModuleNames(names);
            }
        }
        return names;
    }
View Full Code Here

        List<ModuleName> failedModules = new ArrayList<ModuleName>();
        List<String> failedModulePackages = new ArrayList<String>();
        List<Boolean> failedModuleInternal = new ArrayList<Boolean>();
       
        for (final ModuleName moduleName : moduleNamesSet) {
            ModuleTypeInfo moduleTypeInfo = calServices.getWorkspaceManager().getModuleTypeInfo(moduleName);

            String targetPackage = basePackage + ".module";
            if (moduleName.toSourceText().startsWith("Cal.Internal.Optimizer")) {
                targetPackage = basePackage + ".internal.module";
            }
View Full Code Here

    /**    
     * @return handy TypeExpr constants for common Prelude types.
     */
    public PreludeTypeConstants getPreludeTypeConstants() {
       
        ModuleTypeInfo currentPreludeTypeInfo;
        ModuleTypeInfo workingModuleTypeInfo = perspective.getWorkingModuleTypeInfo();
       
        if (workingModuleTypeInfo.getModuleName().equals(CAL_Prelude.MODULE_NAME)){
            currentPreludeTypeInfo = workingModuleTypeInfo;
       
        } else {
            currentPreludeTypeInfo = workingModuleTypeInfo.getDependeeModuleTypeInfo(CAL_Prelude.MODULE_NAME);
        }
       
        if (currentPreludeTypeInfo != preludeTypeInfo) {   // also handles if info == null.
            this.preludeTypeInfo = currentPreludeTypeInfo;
            this.preludeTypeConstants = new PreludeTypeConstants(preludeTypeInfo);
View Full Code Here

            index++;
        }       
       
        TypeExpr switchedType = newValueNode.getTypeExpr();       
                   
        ModuleTypeInfo currentModuleTypeInfo = valueNodeBuilderHelper.getPerspective().getWorkingModuleTypeInfo();
                   
        TypeExpr[] updatedSpecializedTypes = TypeExpr.getUpdatedSpecializedTypes(switchedType, switchIndex, oldSpecializedTypes, unconstrainedTypes, currentModuleTypeInfo);
        if (updatedSpecializedTypes == null) {
            //this is not a valid type switch. Perhaps there should be better validation here.
            throw new IllegalStateException();
View Full Code Here

        ////
        /// Run the preparation pass through all modules, and build up the direct dependency information
        //
        for (int i = 0, n = moduleNames.size(); i < n; i++) {
            ModuleName moduleName = moduleNames.get(i);
            ModuleTypeInfo moduleTypeInfo = programModelManager.getModuleTypeInfo(moduleName);
           
            for (int j = 0, nImportedModules = moduleTypeInfo.getNImportedModules(); j < nImportedModules; j++) {
                ModuleName importedModuleName = moduleTypeInfo.getNthImportedModule(j).getModuleName();
                addDirectModuleDependency(importedModuleName, moduleName);
            }
           
            prepareGenerationForModule(moduleTypeInfo);
        }
       
        ////
        /// Run the actual documentation generation pass
        //
        beginDoc();
       
        // first portion: main documentation
        for (int i = 0, n = moduleNames.size(); i < n; i++) {
            ModuleName moduleName = moduleNames.get(i);
            ModuleTypeInfo moduleTypeInfo = programModelManager.getModuleTypeInfo(moduleName);
            logger.fine(CALDocMessages.getString("STATUS.generatingDocumentationForModule", moduleName));
            generateModuleDoc(moduleTypeInfo);
        }
       
        // optional: usage documentation
        if (shouldGenerateUsageIndices) {
            for (int i = 0, n = moduleNames.size(); i < n; i++) {
                ModuleName moduleName = moduleNames.get(i);
                ModuleTypeInfo moduleTypeInfo = programModelManager.getModuleTypeInfo(moduleName);
                logger.fine(CALDocMessages.getString("STATUS.generatingUsageDocumentationForModule", moduleName));
                generateUsageIndices(moduleTypeInfo);
            }
        }
        endDoc();
View Full Code Here

     * @param typeConstructor the type constructor whose instances are to be returned.
     * @param nameOfModuleToSearchForInstances the module in which to search for instances.
     * @param instances the List to which instances are to be added.
     */
    private void addInstancesOfTypeConsToList(TypeConstructor typeConstructor, ModuleName nameOfModuleToSearchForInstances, List<ClassInstance> instances) {
        ModuleTypeInfo moduleToSearchForInstances = programModelManager.getModuleTypeInfo(nameOfModuleToSearchForInstances);
       
        int nClassInstances = moduleToSearchForInstances.getNClassInstances();
        for (int i = 0; i < nClassInstances; i++) {
            ClassInstance classInstance = moduleToSearchForInstances.getNthClassInstance(i);
           
            if (classInstance.isTypeConstructorInstance()) {
                ClassInstanceIdentifier.TypeConstructorInstance identifier =
                    (ClassInstanceIdentifier.TypeConstructorInstance)classInstance.getIdentifier();
               
View Full Code Here

     * @param typeClass the type class whose instances are to be returned.
     * @param nameOfModuleToSearchForInstances the module in which to search for instances.
     * @param instances the List to which instances are to be added.
     */
    private void addIntancesOfTypeClassToList(TypeClass typeClass, ModuleName nameOfModuleToSearchForInstances, List<ClassInstance> instances) {
        ModuleTypeInfo moduleToSearchForInstances = programModelManager.getModuleTypeInfo(nameOfModuleToSearchForInstances);
       
        int nClassInstances = moduleToSearchForInstances.getNClassInstances();
        for (int i = 0; i < nClassInstances; i++) {
            ClassInstance classInstance = moduleToSearchForInstances.getNthClassInstance(i);
           
            ////
            /// Only add the instance to the list of know instances if both the type class
            /// and the type constructors in the instance type have their documentation generated.
            //
View Full Code Here

     */
    boolean isDocForTypeConsGenerated(ModuleName moduleName, String unqualifiedName) {
        ////
        /// First the entity must exist for its documentation to be generated.
        //
        ModuleTypeInfo moduleTypeInfo = programModelManager.getModuleTypeInfo(moduleName);
        if (moduleTypeInfo == null) {
            return false;
        } else {
            ScopedEntity entity = moduleTypeInfo.getTypeConstructor(unqualifiedName);
            if (entity == null) {
                return false;
            } else {
                ////
                /// Having found the entity, now defer to the user-specified filter for the final answer.
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.ModuleTypeInfo

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.