Skip to content

Commit c2f643c

Browse files
committed
- Static.mo: Improved readability of logic in edge,change and cevalIfConstant
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4945 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 9eed615 commit c2f643c

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

Compiler/Static.mo

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,15 @@ algorithm
262262
e_1 = Exp.simplify(e);
263263
then
264264
(cache,e_1,prop);
265-
case (cache,e,prop,DAE.C_CONST(),(impl as true),_)
266-
equation
267-
e_1 = Exp.simplify(e);
268-
then
269-
(cache,e_1,prop);
270-
case (cache,e,(prop as DAE.PROP(constFlag = c,type_=tp)),DAE.C_CONST(),impl,env) /* as false */
271-
equation
272-
(cache,v,_) = Ceval.ceval(cache,env, e, impl, NONE, NONE, Ceval.MSG());
273-
e_1 = valueExp(v);
274-
then
275-
(cache,e_1,DAE.PROP(tp,c));
276-
277-
case (cache,e,(prop as DAE.PROP_TUPLE(tupleConst = c,type_=tp)),DAE.C_CONST(),impl,env) /* as false */
278-
local DAE.TupleConst c;
265+
266+
case (cache,e,prop,DAE.C_CONST(),impl as false,env)
279267
equation
280268
(cache,v,_) = Ceval.ceval(cache,env, e, impl, NONE, NONE, Ceval.MSG());
281269
e_1 = valueExp(v);
282270
then
283-
(cache,e_1,DAE.PROP_TUPLE(tp,c));
284-
case (cache,e,prop,const,impl,env)
271+
(cache,e_1,prop);
272+
273+
case (cache,e,prop,_,_,_)
285274
equation
286275
e_1 = Exp.simplify(e);
287276
then
@@ -5296,7 +5285,7 @@ algorithm
52965285
then
52975286
(cache,DAE.CALL(Absyn.IDENT("edge"),{exp_1},false,true,DAE.ET_BOOL(),DAE.NO_INLINE),DAE.PROP((DAE.T_BOOL({}),NONE),DAE.C_VAR()),dae);
52985287

5299-
case (cache,env,{exp},_,impl) /* constness: C_PARAM & C_CONST */
5288+
case (cache,env,{exp},_,impl)
53005289
equation
53015290
(cache,exp_1,DAE.PROP((DAE.T_BOOL({}),_),c),_,dae) = elabExp(cache,env, exp, impl, NONE,true);
53025291
exp_2 = valueExp(Values.BOOL(false));
@@ -5532,6 +5521,7 @@ algorithm
55325521
local
55335522
DAE.Exp exp_1;
55345523
DAE.ComponentRef cr_1;
5524+
DAE.Const c;
55355525
tuple<DAE.TType, Option<Absyn.Path>> tp1;
55365526
list<Env.Frame> env;
55375527
Absyn.Exp exp;
@@ -5558,14 +5548,8 @@ algorithm
55585548

55595549
case (cache,env,{(exp as Absyn.CREF(componentRef = cr))},_,impl) /* simple type, constant variability */
55605550
equation
5561-
(cache,(exp_1 as DAE.CREF(cr_1,_)),DAE.PROP(tp1,DAE.C_CONST()),_,dae) = elabExp(cache,env, exp, impl, NONE,true);
5562-
Types.simpleType(tp1);
5563-
then
5564-
(cache,DAE.CALL(Absyn.IDENT("change"),{exp_1},false,true,DAE.ET_BOOL(),DAE.NO_INLINE),DAE.PROP((DAE.T_BOOL({}),NONE),DAE.C_VAR()),dae);
5565-
5566-
case (cache,env,{(exp as Absyn.CREF(componentRef = cr))},_,impl) /* simple type, param variability */
5567-
equation
5568-
(cache,(exp_1 as DAE.CREF(cr_1,_)),DAE.PROP(tp1,DAE.C_PARAM()),_,dae) = elabExp(cache,env, exp, impl, NONE,true);
5551+
(cache,(exp_1 as DAE.CREF(cr_1,_)),DAE.PROP(tp1,c),_,dae) = elabExp(cache,env, exp, impl, NONE,true);
5552+
true = Types.isParameterOrConstant(c);
55695553
Types.simpleType(tp1);
55705554
then
55715555
(cache,DAE.CALL(Absyn.IDENT("change"),{exp_1},false,true,DAE.ET_BOOL(),DAE.NO_INLINE),DAE.PROP((DAE.T_BOOL({}),NONE),DAE.C_VAR()),dae);

0 commit comments

Comments
 (0)