Changeset 34d31de3 in OpenModelica


Ignore:
Timestamp:
2016-04-02T16:48:24+02:00 (8 years ago)
Author:
hudson <openmodelica@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
28678f06
Parents:
e26c7b2
git-author:
Martin Sjölund <martin.sjolund@…> (04/02/16 16:48:24)
git-committer:
hudson <openmodelica@…> (04/02/16 16:48:24)
Message:

Use constant lookup for more operators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Compiler/FrontEnd/OperatorOverloading.mo

    r22754cb r34d31de3  
    864864  Real to work, operators that work on both Integers and Reals must
    865865  return the Integer type -before- the Real type in the list."
    866   input Absyn.Operator inOperator1;
    867   input DAE.Type inType3;
    868   input DAE.Exp inE1;
    869   input DAE.Type inType4;
    870   input DAE.Exp inE2;
     866  input Absyn.Operator inOperator;
    871867  output list<tuple<DAE.Operator, list<DAE.Type>, DAE.Type>> ops;
     868  input output DAE.Type t1;
     869  input output DAE.Exp e1;
     870  input output DAE.Type t2;
     871  input output DAE.Exp e2;
    872872  output DAE.Type oty1;
    873873  output DAE.Exp oe1;
     
    876876protected
    877877  package OperatorsBinary
     878    import int_scalar = DAE.T_INTEGER_DEFAULT;
     879    import real_scalar = DAE.T_REAL_DEFAULT;
     880    constant DAE.Operator
     881      int_mul = DAE.MUL(int_scalar),
     882      real_mul = DAE.MUL(real_scalar),
     883      int_mul_sp = DAE.MUL_SCALAR_PRODUCT(int_scalar),
     884      real_mul_sp = DAE.MUL_SCALAR_PRODUCT(real_scalar),
     885      int_mul_mp = DAE.MUL_MATRIX_PRODUCT(DAE.T_INTEGER_DEFAULT),
     886      real_mul_mp = DAE.MUL_MATRIX_PRODUCT(DAE.T_REAL_DEFAULT);
     887    constant DAE.Type
     888      int_vector = DAE.T_ARRAY(int_scalar,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource),
     889      int_matrix = DAE.T_ARRAY(int_vector,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource),
     890      real_vector = DAE.T_ARRAY(real_scalar,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource),
     891      real_matrix = DAE.T_ARRAY(real_vector,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource);
    878892    constant list<tuple<DAE.Operator, list<DAE.Type>, DAE.Type>>
    879893      // ADD
    880       addIntArrays = list((DAE.ADD_ARR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,at},at) for at in intarrtypes),
    881       addRealArrays = list((DAE.ADD_ARR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,at},at) for at in realarrtypes),
     894      addIntArrays = list((DAE.ADD_ARR(int_vector), {at,at},at) for at in intarrtypes),
     895      addRealArrays = list((DAE.ADD_ARR(real_vector), {at,at},at) for at in realarrtypes),
    882896      addStringArrays = list((DAE.ADD_ARR(DAE.T_ARRAY(DAE.T_STRING_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,at},at) for at in stringarrtypes),
    883897      addScalars = {
    884             (DAE.ADD(DAE.T_INTEGER_DEFAULT),
    885             {DAE.T_INTEGER_DEFAULT,DAE.T_INTEGER_DEFAULT},DAE.T_INTEGER_DEFAULT),
    886             (DAE.ADD(DAE.T_REAL_DEFAULT),
    887             {DAE.T_REAL_DEFAULT,DAE.T_REAL_DEFAULT},DAE.T_REAL_DEFAULT),
    888             (DAE.ADD(DAE.T_STRING_DEFAULT),
    889             {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_STRING_DEFAULT)},
     898        (DAE.ADD(int_scalar), {int_scalar,int_scalar},int_scalar),
     899        (DAE.ADD(real_scalar), {real_scalar,real_scalar},real_scalar),
     900        (DAE.ADD(DAE.T_STRING_DEFAULT), {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_STRING_DEFAULT)
     901      },
    890902      addTypes = listAppend(addScalars, listAppend(addIntArrays, listAppend(addRealArrays, addStringArrays))),
    891903
    892904      // ADD_EW
    893       addIntArrayScalars = list((DAE.ADD_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,rhs},at) threaded for at in intarrtypes, rhs in inttypes),
    894       addRealArrayScalars = list((DAE.ADD_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,rhs},at) threaded for at in realarrtypes, rhs in realtypes),
     905      addIntArrayScalars = list((DAE.ADD_ARRAY_SCALAR(int_vector), {at,rhs},at) threaded for at in intarrtypes, rhs in inttypes),
     906      addRealArrayScalars = list((DAE.ADD_ARRAY_SCALAR(real_vector), {at,rhs},at) threaded for at in realarrtypes, rhs in realtypes),
    895907      addStringArrayScalars = list((DAE.ADD_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_STRING_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)), {at,rhs},at) threaded for at in stringarrtypes, rhs in stringtypes),
    896       addEwTypes = listAppend(addIntArrayScalars, listAppend(addRealArrayScalars, listAppend(addStringArrayScalars, addTypes)))
    897       ;
     908      addEwTypes = listAppend(addIntArrayScalars, listAppend(addRealArrayScalars, listAppend(addStringArrayScalars, addTypes))),
     909
     910      // SUB
     911      subIntArrays = list((DAE.SUB_ARR(int_vector), {at,at},at) for at in intarrtypes),
     912      subRealArrays = list((DAE.SUB_ARR(real_vector), {at,at},at) for at in realarrtypes),
     913      subScalars = {
     914        (DAE.SUB(int_scalar),{int_scalar,int_scalar},int_scalar),
     915        (DAE.SUB(real_scalar),{real_scalar,real_scalar},real_scalar)
     916      },
     917      subTypes = listAppend(subScalars, listAppend(subIntArrays, subRealArrays)),
     918
     919      // SUB_EW
     920      subIntArrayScalars = list((DAE.SUB_SCALAR_ARRAY(int_vector), {lhs,at},at) threaded for at in intarrtypes, lhs in inttypes),
     921      subRealArrayScalars = list((DAE.SUB_SCALAR_ARRAY(real_vector), {lhs,at},at) threaded for at in realarrtypes, lhs in realtypes),
     922      subEwTypes = listAppend(subScalars, listAppend(subIntArrayScalars, listAppend(subRealArrayScalars, listAppend(subIntArrays, subRealArrays)))),
     923
     924      // MUL
     925      mulScalars = {
     926          (int_mul,{int_scalar,int_scalar},int_scalar),
     927          (real_mul,{real_scalar,real_scalar},real_scalar)
     928      },
     929      mulScalarProduct = {
     930        (int_mul_sp,{int_vector,int_vector},int_scalar),
     931        (real_mul_sp,{real_vector,real_vector},real_scalar)
     932      },
     933      mulMatrixProduct = {
     934        (int_mul_mp,{int_vector,int_matrix},int_vector),
     935        (int_mul_mp,{int_matrix,int_vector},int_vector),
     936        (int_mul_mp,{int_matrix,int_matrix},int_matrix),
     937        (real_mul_mp,{real_vector,real_matrix},real_vector),
     938        (real_mul_mp,{real_matrix,real_vector},real_vector),
     939        (real_mul_mp,{real_matrix,real_matrix},real_matrix)
     940      },
     941      mulIntArrayScalars = list((DAE.MUL_ARRAY_SCALAR(int_vector), {at,rhs},at) threaded for at in intarrtypes, rhs in inttypes),
     942      mulRealArrayScalars = list((DAE.MUL_ARRAY_SCALAR(real_vector), {at,rhs},at) threaded for at in realarrtypes, rhs in realtypes),
     943      mulTypes = listAppend(mulScalars, listAppend(mulIntArrayScalars, listAppend(mulRealArrayScalars, listAppend(mulScalarProduct,mulMatrixProduct)))),
     944
     945      // MUL_EW
     946      mulIntArray = list((DAE.MUL_ARR(int_vector), {at,at},at) for at in intarrtypes),
     947      mulRealArray = list((DAE.MUL_ARR(real_vector), {at,at},at) for at in realarrtypes),
     948      mulEwTypes = listAppend(mulScalars, listAppend(mulIntArrayScalars, listAppend(mulRealArrayScalars, listAppend(mulIntArray, mulRealArray))));
    898949  end OperatorsBinary;
    899 algorithm
    900   (ops,oty1,oe1,oty2,oe2) :=
    901   matchcontinue (inOperator1,inType3,inE1,inType4,inE2)
     950  DAE.Type t;
     951  DAE.Exp e;
     952  Absyn.Operator op=inOperator;
     953  Boolean ia1=Types.isArray(t1), ia2=Types.isArray(t2);
     954algorithm
     955  if ia2 and (not ia1) then
     956    (e1,e2,t1,t2) := match op
     957      // element-wise equivalent operators
     958      case Absyn.ADD_EW() then (e2,e1,t2,t1);
     959      case Absyn.MUL() then (e2,e1,t2,t1);
     960      case Absyn.MUL_EW() then (e2,e1,t2,t1);
     961      // Does not need EW-equiv operators
     962      else (e1,e2,t1,t2);
     963    end match;
     964  elseif ia1 and (not ia2) then
     965    (op,e2) := match op
     966      // element-wise equivalent operators
     967      case Absyn.SUB_EW() then (Absyn.ADD_EW(),Expression.negate(e2));
     968      // Does not need EW-equiv operators
     969      else (op,e2);
     970    end match;
     971  end if;
     972  try
     973  ops := match op
    902974    local
    903975      list<tuple<DAE.Operator, list<DAE.Type>, DAE.Type>> intarrs,realarrs,boolarrs,stringarrs,scalars,arrays,types,scalarprod,matrixprod,intscalararrs,realscalararrs,intarrsscalar,realarrsscalar,realarrscalar,arrscalar,stringarrsscalar;
    904976      tuple<DAE.Operator, list<DAE.Type>, DAE.Type> enum_op;
    905       DAE.Type t1,t2,int_scalar,int_vector,int_matrix,real_scalar,real_vector,real_matrix;
     977      DAE.Type int_scalar,int_vector,int_matrix,real_scalar,real_vector,real_matrix;
    906978      DAE.Operator int_mul,real_mul,int_mul_sp,real_mul_sp,int_mul_mp,real_mul_mp,real_div,real_pow;
    907       Absyn.Operator op;
    908       DAE.Exp e1,e2;
    909 
    910     // arithmetical operators
    911     case (Absyn.ADD(),t1,e1,t2,e2)
    912       then (OperatorsBinary.addTypes,t1,e1,t2,e2);
    913 
    914     // arithmetical element wise operators
    915     case (Absyn.ADD_EW(),t1,e1,t2,e2)
    916       equation
    917         false = Types.isArray(t2) and (not Types.isArray(t1));
    918       then (OperatorsBinary.addEwTypes,t1,e1,t2,e2);
    919 
    920     // arithmetical operators
    921     case (Absyn.SUB(),t1,e1,t2,e2)
    922       equation
    923         intarrs = operatorReturn(DAE.SUB_ARR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    924                     intarrtypes, intarrtypes, intarrtypes);
    925         realarrs = operatorReturn(DAE.SUB_ARR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    926                      realarrtypes, realarrtypes, realarrtypes);
    927         scalars = {
    928           (DAE.SUB(DAE.T_INTEGER_DEFAULT),
    929           {DAE.T_INTEGER_DEFAULT,DAE.T_INTEGER_DEFAULT},DAE.T_INTEGER_DEFAULT),
    930           (DAE.SUB(DAE.T_REAL_DEFAULT),
    931           {DAE.T_REAL_DEFAULT,DAE.T_REAL_DEFAULT},DAE.T_REAL_DEFAULT)};
    932         types = List.flatten({scalars,intarrs,realarrs});
    933       then
    934         (types,t1,e1,t2,e2);
    935 
    936     // arithmetical element wise operators
    937     case (Absyn.SUB_EW(),t1,e1,t2,e2)
    938       equation
    939         false = Types.isArray(t1) and (not Types.isArray(t2));
    940         intarrs = operatorReturn(DAE.SUB_ARR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    941                     intarrtypes, intarrtypes, intarrtypes);
    942         realarrs = operatorReturn(DAE.SUB_ARR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    943                      realarrtypes, realarrtypes, realarrtypes);
    944         scalars = {
    945           (DAE.SUB(DAE.T_INTEGER_DEFAULT),
    946           {DAE.T_INTEGER_DEFAULT,DAE.T_INTEGER_DEFAULT},DAE.T_INTEGER_DEFAULT),
    947           (DAE.SUB(DAE.T_REAL_DEFAULT),
    948           {DAE.T_REAL_DEFAULT,DAE.T_REAL_DEFAULT},DAE.T_REAL_DEFAULT)};
    949         intscalararrs = operatorReturn(DAE.SUB_SCALAR_ARRAY(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    950                           inttypes, intarrtypes, intarrtypes);
    951         realscalararrs = operatorReturn(DAE.SUB_SCALAR_ARRAY(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    952                            realtypes, realarrtypes, realarrtypes);
    953         types = List.flatten({scalars,intscalararrs,realscalararrs,intarrs,realarrs});
    954       then
    955         (types,t1,e1,t2,e2);
    956 
    957     case (Absyn.MUL(),t1,e1,t2,e2)
    958       equation
    959         false = Types.isArray(t2) and (not Types.isArray(t1));
    960         int_mul = DAE.MUL(DAE.T_INTEGER_DEFAULT);
    961         real_mul = DAE.MUL(DAE.T_REAL_DEFAULT);
    962         int_mul_sp = DAE.MUL_SCALAR_PRODUCT(DAE.T_INTEGER_DEFAULT);
    963         real_mul_sp = DAE.MUL_SCALAR_PRODUCT(DAE.T_REAL_DEFAULT);
    964         int_mul_mp = DAE.MUL_MATRIX_PRODUCT(DAE.T_INTEGER_DEFAULT);
    965         real_mul_mp = DAE.MUL_MATRIX_PRODUCT(DAE.T_REAL_DEFAULT);
    966         int_scalar = DAE.T_INTEGER_DEFAULT;
    967         int_vector = DAE.T_ARRAY(int_scalar,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource);
    968         int_matrix = DAE.T_ARRAY(int_vector,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource);
    969         real_scalar = DAE.T_REAL_DEFAULT;
    970         real_vector = DAE.T_ARRAY(real_scalar,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource);
    971         real_matrix = DAE.T_ARRAY(real_vector,{DAE.DIM_UNKNOWN()},DAE.emptyTypeSource);
    972         scalars = {(int_mul,{int_scalar,int_scalar},int_scalar),
    973           (real_mul,{real_scalar,real_scalar},real_scalar)};
    974         scalarprod = {(int_mul_sp,{int_vector,int_vector},int_scalar),
    975           (real_mul_sp,{real_vector,real_vector},real_scalar)};
    976         matrixprod = {(int_mul_mp,{int_vector,int_matrix},int_vector),
    977           (int_mul_mp,{int_matrix,int_vector},int_vector),(int_mul_mp,{int_matrix,int_matrix},int_matrix),
    978           (real_mul_mp,{real_vector,real_matrix},real_vector),(real_mul_mp,{real_matrix,real_vector},real_vector),
    979           (real_mul_mp,{real_matrix,real_matrix},real_matrix)};
    980         intarrsscalar = operatorReturn(DAE.MUL_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    981                           intarrtypes, inttypes, intarrtypes);
    982         realarrsscalar = operatorReturn(DAE.MUL_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    983                            realarrtypes, realtypes, realarrtypes);
    984         types = List.flatten({scalars,intarrsscalar,realarrsscalar,scalarprod,matrixprod});
    985       then
    986         (types,t1,e1,t2,e2);
    987 
    988     case (Absyn.MUL_EW(),t1,e1,t2,e2) /* Arithmetical operators */
    989       equation
    990         false = Types.isArray(t2) and (not Types.isArray(t1));
    991         intarrs = operatorReturn(DAE.MUL_ARR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    992           intarrtypes, intarrtypes, intarrtypes);
    993         realarrs = operatorReturn(DAE.MUL_ARR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    994           realarrtypes, realarrtypes, realarrtypes);
    995         scalars = {
    996           (DAE.MUL(DAE.T_INTEGER_DEFAULT),
    997           {DAE.T_INTEGER_DEFAULT,DAE.T_INTEGER_DEFAULT},DAE.T_INTEGER_DEFAULT),
    998           (DAE.MUL(DAE.T_REAL_DEFAULT),
    999           {DAE.T_REAL_DEFAULT,DAE.T_REAL_DEFAULT},DAE.T_REAL_DEFAULT)};
    1000         intarrsscalar = operatorReturn(DAE.MUL_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_INTEGER_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    1001           intarrtypes, inttypes, intarrtypes);
    1002         realarrsscalar = operatorReturn(DAE.MUL_ARRAY_SCALAR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
    1003           realarrtypes, realtypes, realarrtypes);
    1004         types = List.flatten({scalars,intarrsscalar,realarrsscalar,intarrs,realarrs});
    1005       then
    1006         (types,t1,e1,t2,e2);
    1007 
    1008     case (Absyn.DIV(),t1,e1,t2,e2)
     979
     980    case Absyn.ADD() then OperatorsBinary.addTypes;
     981    case Absyn.ADD_EW() then OperatorsBinary.addEwTypes;
     982    case Absyn.SUB() then OperatorsBinary.subTypes;
     983    case Absyn.SUB_EW() then OperatorsBinary.subEwTypes;
     984    case Absyn.MUL() then OperatorsBinary.mulTypes;
     985    case Absyn.MUL_EW() then OperatorsBinary.mulEwTypes;
     986
     987    case Absyn.DIV()
    1009988      equation
    1010989        real_div = DAE.DIV(DAE.T_REAL_DEFAULT);
     
    1014993          realarrtypes, realtypes, realarrtypes);
    1015994        types = List.flatten({scalars,realarrscalar});
    1016       then
    1017         (types,t1,e1,t2,e2);
    1018 
    1019     case (Absyn.DIV_EW(),t1,e1,t2,e2) /* Arithmetical operators */
     995      then types;
     996
     997    case Absyn.DIV_EW()
    1020998      equation
    1021999        realarrs = operatorReturn(DAE.DIV_ARR(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
     
    10301008        types = List.flatten({scalars,realscalararrs,
    10311009          realarrsscalar,realarrs});
    1032       then
    1033         (types,t1,e1,t2,e2);
    1034 
    1035     case (Absyn.POW(),t1,e1,t2,e2)
     1010      then types;
     1011
     1012    case Absyn.POW()
    10361013      equation
    10371014        // Note: POW_ARR uses Integer exponents, while POW only uses Real exponents
     
    10461023          real_matrix)};
    10471024        types = List.flatten({scalars,arrscalar});
    1048       then
    1049         (types,t1,e1,t2,e2);
    1050 
    1051     case (Absyn.POW_EW(),t1,e1,t2,e2)
     1025      then types;
     1026
     1027    case Absyn.POW_EW()
    10521028      equation
    10531029        realarrs = operatorReturn(DAE.POW_ARR2(DAE.T_ARRAY(DAE.T_REAL_DEFAULT, {DAE.DIM_UNKNOWN()}, DAE.emptyTypeSource)),
     
    10621038        types = List.flatten({scalars,realscalararrs,
    10631039          realarrsscalar,realarrs});
    1064       then
    1065         (types,t1,e1,t2,e2);
    1066 
    1067     case (Absyn.AND(), t1, e1, t2, e2)
     1040      then types;
     1041
     1042    case Absyn.AND()
    10681043      equation
    10691044        scalars = {(DAE.AND(DAE.T_BOOL_DEFAULT), {DAE.T_BOOL_DEFAULT, DAE.T_BOOL_DEFAULT}, DAE.T_BOOL_DEFAULT)};
    10701045        boolarrs = operatorReturn(DAE.AND(DAE.T_BOOL_DEFAULT), boolarrtypes, boolarrtypes, boolarrtypes);
    10711046        types = List.flatten({scalars, boolarrs});
    1072       then (types,t1,e1,t2,e2);
    1073 
    1074     case (Absyn.OR(), t1, e1, t2, e2)
     1047      then types;
     1048
     1049    case Absyn.OR()
    10751050      equation
    10761051        scalars = {(DAE.OR(DAE.T_BOOL_DEFAULT), {DAE.T_BOOL_DEFAULT, DAE.T_BOOL_DEFAULT}, DAE.T_BOOL_DEFAULT)};
    10771052        boolarrs = operatorReturn(DAE.OR(DAE.T_BOOL_DEFAULT), boolarrtypes, boolarrtypes, boolarrtypes);
    10781053        types = List.flatten({scalars, boolarrs});
    1079       then (types,t1,e1,t2,e2);
     1054      then types;
    10801055
    10811056    // Relational operators
    1082     case (Absyn.LESS(),t1,e1,t2,e2)
     1057    case Absyn.LESS()
    10831058      equation
    10841059        enum_op = makeEnumOperator(DAE.LESS(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    10941069            {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_BOOL_DEFAULT)};
    10951070        types = List.flatten({scalars});
    1096       then (types,t1,e1,t2,e2);
    1097 
    1098     case (Absyn.LESSEQ(),t1,e1,t2,e2)
     1071      then types;
     1072
     1073    case Absyn.LESSEQ()
    10991074      equation
    11001075        enum_op = makeEnumOperator(DAE.LESSEQ(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    11101085            {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_BOOL_DEFAULT)};
    11111086        types = List.flatten({scalars});
    1112       then (types,t1,e1,t2,e2);
    1113 
    1114     case (Absyn.GREATER(),t1,e1,t2,e2)
     1087      then types;
     1088
     1089    case Absyn.GREATER()
    11151090      equation
    11161091        enum_op = makeEnumOperator(DAE.GREATER(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    11261101            {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_BOOL_DEFAULT)};
    11271102        types = List.flatten({scalars});
    1128       then (types,t1,e1,t2,e2);
    1129 
    1130     case (Absyn.GREATEREQ(),t1,e1,t2,e2)
     1103      then types;
     1104
     1105    case Absyn.GREATEREQ()
    11311106      equation
    11321107        enum_op = makeEnumOperator(DAE.GREATEREQ(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    11421117            {DAE.T_STRING_DEFAULT,DAE.T_STRING_DEFAULT},DAE.T_BOOL_DEFAULT)};
    11431118        types = List.flatten({scalars});
    1144       then (types,t1,e1,t2,e2);
    1145 
    1146     case (Absyn.EQUAL(),t1,e1,t2,e2)
     1119      then types;
     1120
     1121    case Absyn.EQUAL()
    11471122      equation
    11481123        enum_op = makeEnumOperator(DAE.EQUAL(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    11581133            {DAE.T_BOOL_DEFAULT,DAE.T_BOOL_DEFAULT},DAE.T_BOOL_DEFAULT)::
    11591134          {};
    1160       then
    1161         (types,t1,e1,t2,e2);
    1162 
    1163     case (Absyn.NEQUAL(),t1,e1,t2,e2)
     1135      then types;
     1136
     1137    case Absyn.NEQUAL()
    11641138      equation
    11651139        enum_op = makeEnumOperator(DAE.NEQUAL(DAE.T_ENUMERATION_DEFAULT), t1, t2);
     
    11751149            {DAE.T_BOOL_DEFAULT,DAE.T_BOOL_DEFAULT},DAE.T_BOOL_DEFAULT)::
    11761150          {};
    1177       then
    1178         (types,t1,e1,t2,e2);
    1179 
    1180     // element-wise equivalent operators
    1181     case (Absyn.ADD_EW(),t1,e1,t2,e2)
    1182       equation
    1183         true = Types.isArray(t2) and (not Types.isArray(t1));
    1184         (types,t1,e1,t2,e2) = operatorsBinary(Absyn.ADD_EW(),t2,e2,t1,e1);
    1185       then (types,t1,e1,t2,e2);
    1186 
    1187     case (Absyn.SUB_EW(),t1,e1,t2,e2)
    1188       equation
    1189         true = Types.isArray(t1) and (not Types.isArray(t2));
    1190         e2 = Expression.negate(e2);
    1191         (types,t1,e1,t2,e2) = operatorsBinary(Absyn.ADD_EW(),t1,e1,t2,e2);
    1192       then (types,t1,e1,t2,e2);
    1193 
    1194     case (Absyn.MUL(),t1,e1,t2,e2)
    1195       equation
    1196         true = Types.isArray(t2) and (not Types.isArray(t1));
    1197         (types,t1,e1,t2,e2) = operatorsBinary(Absyn.MUL(),t2,e2,t1,e1);
    1198       then (types,t1,e1,t2,e2);
    1199 
    1200     case (Absyn.MUL_EW(),t1,e1,t2,e2)
    1201       equation
    1202         true = Types.isArray(t2) and (not Types.isArray(t1));
    1203         (types,t1,e1,t2,e2) = operatorsBinary(Absyn.MUL_EW(),t2,e2,t1,e1);
    1204       then (types,t1,e1,t2,e2);
    1205 
    1206     case (op,_,_,_,_)
    1207       equation
    1208         true = Flags.isSet(Flags.FAILTRACE);
    1209         Debug.traceln("OperatorOverloading.operatorsBinary failed, op: " + Dump.opSymbol(op));
    1210       then
    1211         fail();
    1212   end matchcontinue;
     1151      then types;
     1152  end match;
     1153  else
     1154    true := Flags.isSet(Flags.FAILTRACE);
     1155    Debug.traceln("OperatorOverloading.operatorsBinary failed, op: " + Dump.opSymbol(op));
     1156    fail();
     1157  end try;
    12131158end operatorsBinary;
    12141159
Note: See TracChangeset for help on using the changeset viewer.