Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.ModuleTypeInfo


        IntellicutListEntry listEntry = (IntellicutListEntry) intellicutPanel.getIntellicutList().getSelectedValue();

        if (listEntry != null) {
           
            GemEntity gemEntity = (GemEntity) listEntry.getData();
            ModuleTypeInfo currentModuleInfo = valueEditorManager.getPerspective().getWorkingModuleTypeInfo();
            TypeExpr valueNodeType = getValueNode().getTypeExpr();
            TypeExpr functionType = gemEntity.getTypeExpr();
            TypeExpr unifiedType;
           
            try {
View Full Code Here


    @Override
    protected Set<TypeExpr> getMatchingInputTypes() {
       
        Set<TypeExpr> dataTypes = getAvailableInputTypes();
        Set<TypeExpr> matchingTypes = new HashSet<TypeExpr>();
        ModuleTypeInfo currentModuleTypeInfo = valueEditorManager.getPerspective().getWorkingModuleTypeInfo();

        // We can only type switch if the least constrained type is a TypeVar.
        TypeExpr leastConstrainedType = getContext().getLeastConstrainedTypeExpr().copyTypeExpr();
        TypeExpr valueNodeTypeExpr = getValueNode().getTypeExpr();
       
View Full Code Here

               
                if (visibleDataConstructors == null || visibleDataConstructors.length == 0) {

                    // Include non-visible constructors if there are no visible ones.
                   
                    ModuleTypeInfo moduleTypeInfo = getPerspective().getMetaModule(typeConsName.getModuleName()).getTypeInfo();
                    TypeConstructor typeCons = moduleTypeInfo.getTypeConstructor(typeConsName.getUnqualifiedName());
                   
                    for (int n = 0, count = typeCons.getNDataConstructors(); n < count; n++) {
                       
                        DataConstructor dataCons = typeCons.getNthDataConstructor(n);
                        int nameLength = fontMetrics.stringWidth(dataCons.getAdaptedName(namingPolicy));
View Full Code Here

            if (defaultValues != null) {
                // If the value node is a list then use a pick list value entry panel which will popup a
                // customized list editor.  Otherwise the value node is a single value and we can use the
                // pick list value editor which is just a combo box.
                ModuleTypeInfo typeInfo = valueEditorHierarchyManager.getValueEditorManager().getPerspective().getWorkingModuleTypeInfo();
                TypeExpr dataType = valueNode.getTypeExpr();
                if (dataType.isListType() && TypeExpr.canUnifyType(dataType, defaultValues.getTypeExpr(), typeInfo)) {
                    return new PickListValueEntryPanel(valueEditorHierarchyManager,
                                                       valueNode,
                                                       (ListValueNode)defaultValues,
View Full Code Here

    @Override
    protected ValueEditor getValueEditor() {
        // If the type being edited is "[a]" then the default values is normally "[a]".  In this case
        // we want to popup a list value editor where each element can be one from the list.
        ValueEditor editor;
        ModuleTypeInfo typeInfo = valueEditorHierarchyManager.getValueEditorManager().getPerspective().getWorkingModuleTypeInfo();
        TypeExpr dataType = getValueNode().getTypeExpr();
        if (dataType.isListType() && TypeExpr.canUnifyType(dataType, defaultValues.getTypeExpr(), typeInfo)) {
            editor = new ListTupleValueEditor(valueEditorHierarchyManager, null) {
                private static final long serialVersionUID = -6933035868423482449L;
View Full Code Here

                return module.getModuleName();
            }
        }
       
        for (int i = 0, n = module.getNImportedModules(); i < n; ++i) {
            ModuleTypeInfo importedModule = module.getNthImportedModule(i);
            ModuleName mn = findModuleContainingType(visitedModules, typeName, importedModule);
            if (mn != null) {
                return mn;
            }
        }
View Full Code Here

                return tc;
            }
        }
       
        for (int i = 0, n = module.getNImportedModules(); i < n; ++i) {
            ModuleTypeInfo importedModule = module.getNthImportedModule(i);
            TypeConstructor tc = findTypeConstructorForJavaClass(javaType, importedModule, visitedModules);
            if (tc != null) {
                return tc;
            }
        }
View Full Code Here

        if (!verbose) {
            getIceLogger().setLevel(Level.WARNING);
        }
       
        // Get the module type info for the specified module.
        ModuleTypeInfo moduleTypeInfo = getWorkspaceManager().getModuleTypeInfo(moduleName);
        if (moduleTypeInfo == null) {
            throw new NullPointerException("Unable to retrieve type information for module " + moduleName);
        }
       
        // Generate the i/o code.  This is returned in the form of a
View Full Code Here

     * @param qualifyExpressionText if true, an attempt will be made to qualify unqualified symbols in expressionText before it is run.
     * False to just run expressionText without attempting qualification.
     * @return whether execution terminated normally.
     */
    public boolean runExpression(ModuleName moduleName, String expressionText, boolean qualifyExpressionText) {
        ModuleTypeInfo moduleTypeInfo = getProgramModelManager().getModuleTypeInfo(moduleName);

        if (moduleTypeInfo == null) {
            if (hasModuleSource(moduleName)) {
                calLogger.severe("Error: Module \"" + moduleName + "\" has compilation errors (or is currently in the process of being compiled).");
            } else {
                calLogger.severe("Error: Module \"" + moduleName + "\" could not be found.");
            }
            return false;
        }

        String maybeQualifiedExpressionText;
        if (qualifyExpressionText) {
            maybeQualifiedExpressionText = qualifyCodeExpression(moduleName, expressionText);
            if (maybeQualifiedExpressionText == null) {
                return false;
            }
       
        } else {
            maybeQualifiedExpressionText = expressionText;
        }

        // pick a name which doesn't exist in the module.
        String targetName = "target";
        int index = 1;
        while (moduleTypeInfo.getFunctionalAgent(targetName) != null) {
            targetName = "target" + index;
            index++;
        }
        EntryPoint entryPoint = compileAdjunct(QualifiedName.make(moduleName, targetName), maybeQualifiedExpressionText);

View Full Code Here

            if (moduleName.equals(CALPlatformTestModuleNames.CALDocTest)) {
                // CALDocTest is allowed to have unresolved references (because it tests CALDoc!)
                continue;
            }
           
            final ModuleTypeInfo moduleInfo = calServices.getWorkspaceManager().getModuleTypeInfo(moduleName);
           
            // Gather all the CALDoc comments in the module
           
            final Map<String, CALDocComment> caldocComments = new LinkedHashMap<String, CALDocComment>();
           
            caldocComments.put("module " + moduleName, moduleInfo.getCALDocComment());
           
            for (int i = 0, n = moduleInfo.getNFunctions(); i < n; i++) {
                final Function function = moduleInfo.getNthFunction(i);
                caldocComments.put("function " + function.getName().getQualifiedName(), function.getCALDocComment());
            }
           
            for (int i = 0, n = moduleInfo.getNTypeConstructors(); i < n; i++) {
                final TypeConstructor typeCons = moduleInfo.getNthTypeConstructor(i);
                caldocComments.put("type cons " + typeCons.getName().getQualifiedName(), typeCons.getCALDocComment());

                for (int j = 0, m = typeCons.getNDataConstructors(); j < m; j++) {
                    final DataConstructor dataCons = typeCons.getNthDataConstructor(j);
                    caldocComments.put("data cons " + dataCons.getName().getQualifiedName(), dataCons.getCALDocComment());
                }
            }
           
            for (int i = 0, n = moduleInfo.getNTypeClasses(); i < n; i++) {
                final TypeClass typeClass = moduleInfo.getNthTypeClass(i);
                caldocComments.put("class " + typeClass.getName().getQualifiedName(), typeClass.getCALDocComment());

                for (int j = 0, m = typeClass.getNClassMethods(); j < m; j++) {
                    final ClassMethod method = typeClass.getNthClassMethod(j);
                    caldocComments.put("class method " + method.getName().getQualifiedName(), method.getCALDocComment());
                }
            }
           
            for (int i = 0, n = moduleInfo.getNClassInstances(); i < n; i++) {
                final ClassInstance instance = moduleInfo.getNthClassInstance(i);
                final TypeClass typeClass = instance.getTypeClass();
               
                caldocComments.put("instance " + instance.getNameWithContext(), instance.getCALDocComment());

                for (int j = 0, m = typeClass.getNClassMethods(); j < m; j++) {
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.