@Override
  public void commitValue() {

    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 {
        unifiedType = TypeExpr.unify(valueNodeType, functionType, currentModuleInfo);
      } catch (TypeException e) {
        throw new IllegalStateException(e.getMessage());
      }

      GemEntityValueNode newValueNode = new GemEntityValueNode(gemEntity, unifiedType);
      replaceValueNode(newValueNode, true);
    }

    super.commitValue();
  }
Exemplo n.º 2
0
  /**
   * Return whether autoburning will result in a unification.
   *
   * @param destType The destination type to unify with
   * @param burnEntity on which to attempt "autoburning"
   * @param info the info to use
   * @return AutoburnLogic.AutoburnInfo autoburnable result
   */
  public static AutoburnInfo getAutoburnInfo(
      TypeExpr destType, GemEntity burnEntity, TypeCheckInfo info) {

    // see if we have to do anything
    TypeExpr entityType;
    if (burnEntity == null || (entityType = burnEntity.getTypeExpr()) == null) {
      return AutoburnInfo.makeNoUnificationPossibleAutoburnInfo();
    }

    return getAutoburnInfoWorker(destType, entityType.getTypePieces(), null, info, null);
  }