Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.TypeExpr


    @Override
    protected void commitValue() {
   
        if (clearType) {
            // Note: For TypeExpr which contains uninstantiated TypeVars, we must 'duplicate' them somehow.
            TypeExpr instanceTypeExpr = getContext().getLeastConstrainedTypeExpr();
            ValueNode replacement = getOwnerValueNode().transmuteValueNode(valueEditorManager.getValueNodeBuilderHelper(), valueEditorManager.getValueNodeTransformer(), instanceTypeExpr);

            // Get the TypeVar that we are instantiating.
            replaceValueNode(replacement, true);
View Full Code Here


        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();
       
        if (currentModuleTypeInfo != null && leastConstrainedType instanceof TypeVar) {
           
            for (final TypeExpr typeExpr : dataTypes) {
   
View Full Code Here

        clearButton.addKeyListener(new ClearButtonKeyListener());
        clearButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

        // The clear button is enabled if there are items in the list, or if
        // the value node type is a function that can be cleared to its least constrained type.
        TypeExpr leastConstrainedType = getContext().getLeastConstrainedTypeExpr().copyTypeExpr();
        TypeExpr valueNodeTypeExpr = getValueNode().getTypeExpr();
        boolean canClearFunction = leastConstrainedType instanceof TypeConsApp &&
                                   leastConstrainedType.isFunctionType() &&
                                   !leastConstrainedType.sameType(valueNodeTypeExpr);

        final boolean hasOtherTypes = getIntellicutPanel().getIntellicutListModel().getSize() > 0;
View Full Code Here

    @Override
    public void setOwnerValueNode(ValueNode newValueNode) {
        super.setOwnerValueNode(newValueNode);
       
        Date dateTimeValue = getDateTimeValueNode().getDateTimeValue();
        TypeExpr dateType = valueEditorManager.getValueNodeBuilderHelper().getTypeConstructorForName(CAL_RelativeTime.TypeConstructors.RelativeDate);
        TypeExpr timeType = valueEditorManager.getValueNodeBuilderHelper().getTypeConstructorForName(CAL_RelativeTime.TypeConstructors.RelativeTime);
       
        dateValueEditor.setOwnerValueNode(new RelativeDateValueNode(dateTimeValue, dateType));
        timeValueEditor.setOwnerValueNode(new RelativeTimeValueNode(dateTimeValue, timeType));
    }
View Full Code Here

            } else if (typeIde.equals(CAL_Prelude.TypeConstructors.String)) {
                iconName = "/Resources/string.gif";
               
            } else if (typeIde.equals(CAL_Prelude.TypeConstructors.List)) {
              
                TypeExpr elementTypeExpr = typeConsApp.getArg(0);

                TypeConsApp elementTypeConsApp = elementTypeExpr.rootTypeConsApp();

                if (elementTypeConsApp != null) {

                    QualifiedName elementIde = elementTypeConsApp.getName();
View Full Code Here

            } else if (typeConsName.equals(CAL_Prelude.TypeConstructors.Function)) {
                baseline = "Prelude.FunctionName";

            } else if (typeConsName.equals(CAL_Prelude.TypeConstructors.List)) {

                TypeExpr elementTypeExpr = typeConsApp.getArg(0);
                TypeConsApp elementTypeConsApp = elementTypeExpr.rootTypeConsApp();

                if (elementTypeConsApp != null) {

                    QualifiedName elementTypeConsName = elementTypeConsApp.getName();
View Full Code Here

    public ValueNode getClipboardValue() {
        if (clipboardValueNode == null) {
            return null;
        }
       
        TypeExpr newTypeExpr = clipboardValueNode.getTypeExpr().copyTypeExpr();

        // return a copy
        return valueNodeBuilderHelper.buildValueNode(clipboardValueNode.getValue(), null, newTypeExpr);   
    }
View Full Code Here

        }
       
        // The Record type is special since it has no type constructor entity, but
        // there is a value node / value editor provider to handle it.
        Set<FieldName> fieldNames = new HashSet<FieldName>();
        TypeExpr recordType = TypeExpr.makeFreeRecordType(fieldNames);
        ValueNode valueNode = valueNodeBuilderHelper.getValueNodeForTypeExpr(recordType);
        if (getValueEditorProvider(valueNode, supportInfo, false) != null) {
            types.add(recordType);
        }
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,
                                                       metadataRunner.useDefaultValuesOnly(argumentNumber));
                } else {
View Full Code Here

    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;

                /**
                 * Override the default table cell editor with one that understands pick lists 
View Full Code Here

TOP

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

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.