Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.ModuleTypeInfo


     * Resolves the given name as a data constructor given the current target module.
     * @param name the name to be resolved.
     * @return a QualifiedName for the resolved data constructor, or null if the name cannot be resolved.
     */
    private QualifiedName resolveDataConsName(String name) {
        ModuleTypeInfo moduleTypeInfo = getWorkspaceManager().getModuleTypeInfo(targetModule);
       
        QualifiedName resolvedName = CodeAnalyser.resolveEntityNameAccordingToImportUsingClauses(name, Category.DATA_CONSTRUCTOR, moduleTypeInfo);
       
        if (resolvedName != null) {
            return resolvedName;
View Full Code Here


     * Resolves the given name as a type constructor given the current target module.
     * @param name the name to be resolved.
     * @return a QualifiedName for the resolved type constructor, or null if the name cannot be resolved.
     */
    private QualifiedName resolveTypeConsName(String name) {
        ModuleTypeInfo moduleTypeInfo = getWorkspaceManager().getModuleTypeInfo(targetModule);
       
        QualifiedName resolvedName = CodeAnalyser.resolveEntityNameAccordingToImportUsingClauses(name, Category.TYPE_CONSTRUCTOR, moduleTypeInfo);
       
        if (resolvedName != null) {
            return resolvedName;
View Full Code Here

     * Resolves the given name as a type class given the current target module.
     * @param name the name to be resolved.
     * @return a QualifiedName for the resolved type class, or null if the name cannot be resolved.
     */
    private QualifiedName resolveTypeClassName(String name) {
        ModuleTypeInfo moduleTypeInfo = getWorkspaceManager().getModuleTypeInfo(targetModule);
       
        QualifiedName resolvedName = CodeAnalyser.resolveEntityNameAccordingToImportUsingClauses(name, Category.TYPE_CLASS, moduleTypeInfo);
       
        if (resolvedName != null) {
            return resolvedName;
View Full Code Here

                if (qn == null) {
                    return;
                }
                functionName = qn.getQualifiedName();
               
                ModuleTypeInfo mt = getWorkspaceManager().getModuleTypeInfo(qn.getModuleName());
               
                DataConstructor dc = mt.getDataConstructor(qn.getUnqualifiedName());
                if (dc != null) {
                    if (dc.getArity() == 0) {
                        logInfo("Cannot set a breakpoint on a zero arity data constructor.");
                        return;
                    }
                } else 
                if (mt.getFunction(qn.getUnqualifiedName()) == null) {
                    logInfo(qn + " is not a valid function name.");
                    return;
                }
                   
            } catch (IllegalArgumentException e) {
View Full Code Here

     */
    public PreludeTypeConstants getPreludeTypeConstants() {
       
        if (preludeTypeConstants == null) {
           
            ModuleTypeInfo preludeModuleTypeInfo = workspaceManager.getModuleTypeInfo(CAL_Prelude.MODULE_NAME);
            if (preludeModuleTypeInfo == null) {
                throw new IllegalStateException("Must have a successfully compiled Cal.Core.Prelude module before getPreludeTypeConstants can be called.");
            }
           
            preludeTypeConstants = new PreludeTypeConstants(preludeModuleTypeInfo);          
View Full Code Here

        if (typeExpr == null) {
            return Collections.emptySet();
        }

        // Find all gems matching this type.
        final ModuleTypeInfo targetModuleTypeInfo = getModuleTypeInfo(scopeModule);
        GemFilter filter = new GemFilter() {
            @Override
            public boolean select(GemEntity gemEntity) {
                TypeExpr gemType = gemEntity.getTypeExpr();
                return TypeExpr.canPatternMatch(gemType, typeExpr, targetModuleTypeInfo);
View Full Code Here

        if (returnTypeExpr == null) {
            return Collections.emptySet();
        }

        // Find all gems matching this type.
        final ModuleTypeInfo targetModuleTypeInfo = getModuleTypeInfo(scopeModule);
        GemFilter filter = new GemFilter() {
            @Override
            public boolean select(GemEntity gemEntity) {
                TypeExpr gemResultType = gemEntity.getTypeExpr().getResultType();
                return TypeExpr.canPatternMatch(gemResultType, returnTypeExpr, targetModuleTypeInfo);
View Full Code Here

       
        // Check that module != null
        Assert.isNotNullArgument(module, "module");

        int nEntities = module.getNGemEntities();
        ModuleTypeInfo workingModuleTypeInfo = getWorkingModuleTypeInfo();

        // Add all entities from the working module, or only public entities from non-working modules.
        Set<GemEntity> visibleEntitySet = new LinkedHashSet<GemEntity>();
        for (int i = 0; i < nEntities; i++) {

            GemEntity gemEntity = module.getNthGemEntity(i);
           
            if (workingModuleTypeInfo.isEntityVisible(gemEntity.getFunctionalAgent())) {
                visibleEntitySet.add(gemEntity);
            }
        }

        // Apply the view policy if any.
View Full Code Here

        }

        int foundIndex = -1;
        int nImportedModules = workingModule.getNImportedModules();
       
        ModuleTypeInfo workingModuleTypeInfo = workingModule.getTypeInfo();

        for (int i = 0; i < nImportedModules; ++i) {

            gemEntity = workingModule.getNthImportedModule(workspace, i).getGemEntity(unqualifiedName);
            if (gemEntity != null && workingModuleTypeInfo.isEntityVisible(gemEntity.getFunctionalAgent())) {
                foundIndex = i;
                break;
            }
        }

        //Check for an ambiguous import
        if (foundIndex != -1) {

            for (int i = foundIndex + 1; i < nImportedModules; ++i) {

                GemEntity otherEntity = workingModule.getNthImportedModule(workspace, i).getGemEntity(unqualifiedName);
                if (otherEntity != null && workingModuleTypeInfo.isEntityVisible(otherEntity.getFunctionalAgent())) {
                    //ambigious symbol resolution
                    return null;
                }
            }
        }
View Full Code Here

            return gemEntity;
        }

        // check if the unqualifiedName can be resolved in imported modules
        int nImportedModules = workingModule.getNImportedModules();
        ModuleTypeInfo workingModuleTypeInfo = workingModule.getTypeInfo();
        for (int i = 0; i < nImportedModules; ++i) {

            gemEntity = workingModule.getNthImportedModule(workspace, i).getGemEntity(unqualifiedName);
            if (gemEntity != null && workingModuleTypeInfo.isEntityVisible(gemEntity.getFunctionalAgent())) {
                break;
            }
        }

        return gemEntity;
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.