Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.TypeConstructor$DerivingClauseInfo


                // This can either be a supercombinator or a data declaration
                if (label.getExpressionForm().asPackCons() != null) {
                    // This is a data declaration
                    // Add the associated TypeConstructor to the set for later code generation.
                    DataConstructor dc = label.getExpressionForm().asPackCons().getDataConstructor();
                    TypeConstructor typeCons = dc.getTypeConstructor();
                    typeConsSet.add(typeCons);
                } else {
                    // This is a supercombinator.  Emit the definition if necessary.
                    try {
                        LECCModule.FunctionGroupInfo fgi = module.getFunctionGroupInfo(label);
View Full Code Here


            /**
             * Returns a list of the names of the available connection gems.
             */
            private List <String> fetchConnectionGemNames() {
                TypeConstructor typeConstructor = perspective.getTypeConstructor(CAL_DataGems.TypeConstructors.JDBCConnection);
                final TypeExpr typeExpr = TypeExpr.makeNonParametricType(typeConstructor);

                return fetchGemsOfType(typeExpr);
            }
View Full Code Here

                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof TypeConstructorMetadata) {
                QualifiedName qualifiedName = featureName.toQualifiedName();
                ModuleTypeInfo moduleTypeInfoForFeature = owner.getPerspective().getMetaModule(qualifiedName.getModuleName()).getTypeInfo();
                TypeConstructor typeCons = moduleTypeInfoForFeature.getTypeConstructor(qualifiedName.getUnqualifiedName());
               
                CALDocComment caldoc = typeCons.getCALDocComment();
                buffer.append(getBasicMetadataHtml(owner, metadata, caldoc));
                buffer.append(getTypeConstructorMetadataHtml(owner, (TypeConstructorMetadata) metadata));
                buffer.append(getAdditionalMetadataHtml(owner, metadata, caldoc));
               
            } else if (metadata instanceof ClassInstanceMetadata) {
View Full Code Here

     * @param metadata the metadata to get HTML for
     * @return the HTML for type constructor metadata specific information
     */
    private static String getTypeConstructorMetadataHtml(NavFrameOwner owner, TypeConstructorMetadata metadata) {
       
        TypeConstructor typeCons = (TypeConstructor) owner.getPerspective().getWorkspace().getScopedEntity(metadata.getFeatureName());
        StringBuilder buffer = new StringBuilder();
       
        ScopedEntityNamingPolicy namingPolicy = new UnqualifiedUnlessAmbiguous(owner.getPerspective().getWorkingModuleTypeInfo());
       
        // list the data constructors for this type
        buffer.append("<h2>" + getAnchorHtml(CONSTRUCTORS_ANCHOR, NavigatorMessages.getString("NAV_Constructors_Header")) + "</h2>");
        int count = typeCons.getNDataConstructors();
       
        if (count == 0) {
            buffer.append(NavigatorMessages.getString("NAV_NoValue"));
       
        } else {

            buffer.append("<tt>");
                      
            for (int i = 0; i < count; i++) {
                DataConstructor dataCons = typeCons.getNthDataConstructor(i);
                NavAddress dataConsUrl = NavAddress.getAddress(dataCons);
                String dataConsLink = getLinkHtml(dataConsUrl, NavAddressHelper.getDisplayText(owner, dataConsUrl, ScopedEntityNamingPolicy.UNQUALIFIED));
                buffer.append("<b>" + dataConsLink + "</b> :: ");
                buffer.append("<i>" + getTypeStringHtml(owner, dataCons.getTypeExpr(), namingPolicy) + "</i>");
                buffer.append("<br>");
            }
           
            // remove trailing <br>
            buffer.delete(buffer.length() - 4, buffer.length());
            buffer.append("</tt>");
        }
       
        // we have to search all instances in all modules to see if they're an instance of this type
        //todoBI the above comment is false. Need to just search all module imported, either directly or indirectly,
        //into the module in which the instance is defined.
        CALWorkspace workspace = owner.getPerspective().getWorkspace();
        List<TypeClass> classes = new ArrayList<TypeClass>();
        List<ClassInstance> instances = new ArrayList<ClassInstance>();
       
        for (int n = 0, numMods = workspace.getNMetaModules(); n < numMods; n++) {
           
            MetaModule metaModule = workspace.getNthMetaModule(n);
            ModuleTypeInfo moduleTypeInfo = metaModule.getTypeInfo();
           
            for (int i = 0, num = moduleTypeInfo.getNClassInstances(); i < num; i++) {
               
                ClassInstance instance = moduleTypeInfo.getNthClassInstance(i);
               
                if (instance.isTypeConstructorInstance() &&
                    ((ClassInstanceIdentifier.TypeConstructorInstance)instance.getIdentifier()).getTypeConsName().equals(typeCons.getName())) {
                    classes.add(instance.getTypeClass());
                    instances.add(instance);
                }
            }
        }
View Full Code Here

                }
               
                if (instance.getTypeClass().getName().equals(typeClass.getName())) {                  
                    QualifiedName typeConsName = ((TypeConsApp)instance.getType()).getName();
                    MetaModule typeModule = owner.getPerspective().getMetaModule(typeConsName.getModuleName());
                    TypeConstructor typeCons = typeModule.getTypeInfo().getTypeConstructor(typeConsName.getUnqualifiedName());
                    types.add(typeCons);
                    instances.add(instance);
                }
            }
        }
View Full Code Here

        buffer.append("<h2>" + getAnchorHtml(INSTANCE_CLASS_ANCHOR, NavigatorMessages.getString("NAV_InstanceClass_Header")) + "</h2>");
        buffer.append(getLinkHtml(NavAddress.getAddress(typeClass), typeClass.getAdaptedName(namingPolicy)));
       
        if (identifier instanceof ClassInstanceIdentifier.TypeConstructorInstance) {              
            CALFeatureName typeName = CALFeatureName.getTypeConstructorFeatureName(((ClassInstanceIdentifier.TypeConstructorInstance)identifier).getTypeConsName());
            TypeConstructor typeCons = (TypeConstructor) owner.getPerspective().getWorkspace().getScopedEntity(typeName);
            buffer.append("<h2>" + getAnchorHtml(INSTANCE_TYPE_ANCHOR, NavigatorMessages.getString("NAV_InstanceType_Header")) + "</h2>");
            buffer.append(getLinkHtml(NavAddress.getAddress(typeCons), typeCons.getAdaptedName(namingPolicy)));
        }
       
        // list the instance methods of this instance
        buffer.append("<h2>" + getAnchorHtml(INSTANCE_METHODS_ANCHOR, NavigatorMessages.getString("NAV_InstanceMethods_Header")) + "</h2>");
       
View Full Code Here

                typeString = NavigatorMessages.getString("NAV_Constructor_Location");
               
                // figure out the type constructor this data constructor is for
                CALFeatureName dataConsFeatureName = ((DataConstructorMetadata) metadata).getFeatureName();
                QualifiedName dataConsName = dataConsFeatureName.toQualifiedName();
                TypeConstructor parentCons = null;
                int typeConsCount = module.getTypeInfo().getNTypeConstructors();
               
                for (int i = 0; i < typeConsCount; i++) {
                    TypeConstructor typeCons = module.getTypeInfo().getNthTypeConstructor(i);
                   
                    int dataConsCount = typeCons.getNDataConstructors();
                    for (int n = 0; n < dataConsCount; n++) {
                        if (typeCons.getNthDataConstructor(n).getName().equals(dataConsName)) {
                            parentCons = typeCons;
                            break;
                        }
                    }
                   
View Full Code Here

                MetaModule metaModule = owner.getPerspective().getMetaModule(name.getModuleName());
                   
                if (metaModule != null) {
                   
                    TypeClass typeClass = metaModule.getTypeInfo().getTypeClass(name.getUnqualifiedName());
                    TypeConstructor typeCons = metaModule.getTypeInfo().getTypeConstructor(name.getUnqualifiedName());
                   
                    if (typeCons != null) {
                        customToken = getLinkHtml(NavAddress.getAddress(typeCons), customToken);
                       
                    } else if (typeClass != null) {
View Full Code Here

        if (constructorCount > 0) {

            List<NavTreeNode> typeConstructorNodes = new ArrayList<NavTreeNode>(constructorCount);
            for (int i = 0; i < constructorCount; i++) {
               
                TypeConstructor typeConstructor = moduleInfo.getNthTypeConstructor(i);
                NavTreeNode typeConstructorNode = new NavTypeConstructorNode(typeConstructor);
                typeConstructorNodes.add(typeConstructorNode);
               
                // Load the data constructors.
                int dataConstructorCount = typeConstructor.getNDataConstructors();
                for (int n = 0; n < dataConstructorCount; n++) {
                    NavTreeNode dataConstructorNode = new NavDataConstructorNode(typeConstructor.getNthDataConstructor(n));
                    typeConstructorNode.add(dataConstructorNode);
                    urlToNodeMap.put(dataConstructorNode.getAddress(), dataConstructorNode);
                }
            }
           
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.TypeConstructor$DerivingClauseInfo

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.