Changeset f1e1999 in OpenModelica


Ignore:
Timestamp:
2019-11-20T11:36:38+01:00 (5 years ago)
Author:
Adrian Pop <adrian.pop@…>
Branches:
maintenance/v1.15
Children:
53a929e8
Parents:
5fccefeb
git-author:
Per Östlund <perost86@…> (11/13/19 12:27:33)
git-committer:
Adrian Pop <adrian.pop@…> (11/20/19 11:36:38)
Message:

[NF] Fix some Expression.map*Opt functions.

  • Fix mapOpt, mapShallowOpt and mapFoldOpt in Expression, which would return an uninitialized value when given a NONE().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/NFFrontEnd/NFExpression.mo

    r43a2335 rf1e1999  
    20002000    Expression e;
    20012001  algorithm
    2002     if isSome(exp) then
    2003       SOME(e) := exp;
    2004       outExp := SOME(map(e, func));
    2005     end if;
     2002    outExp := match exp
     2003      case SOME(e) then SOME(map(e, func));
     2004      else exp;
     2005    end match;
    20062006  end mapOpt;
    20072007
     
    23402340    Expression e;
    23412341  algorithm
    2342     if isSome(exp) then
    2343       SOME(e) := exp;
    2344       outExp := SOME(func(e));
    2345     end if;
     2342    outExp := match exp
     2343      case SOME(e) then SOME(func(e));
     2344      else exp;
     2345    end match;
    23462346  end mapShallowOpt;
    23472347
     
    32723272    Expression e;
    32733273  algorithm
    3274     if isSome(exp) then
    3275       SOME(e) := exp;
    3276       (e, arg) := mapFold(e, func, arg);
    3277       outExp := SOME(e);
    3278     end if;
     3274    outExp := match exp
     3275      case SOME(e)
     3276        algorithm
     3277          (e, arg) := mapFold(e, func, arg);
     3278        then
     3279          SOME(e);
     3280
     3281      else exp;
     3282    end match;
    32793283  end mapFoldOpt;
    32803284
Note: See TracChangeset for help on using the changeset viewer.