Skip to content

Commit fa268c2

Browse files
committed
- BackendDAECreate: Add start-binding as eq-binding of parameters without binding.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7624 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent d6f3799 commit fa268c2

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

Compiler/BackEnd/BackendDAECreate.mo

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ algorithm
742742
absynCommentOption = comment))
743743
equation
744744
kind_1 = lowerKnownVarkind(kind, name, dir, flowPrefix);
745+
bind = fixParameterStartBinding(bind,dae_var_attr,kind_1);
745746
tp = lowerType(t);
746747
then
747748
BackendDAE.VAR(name,kind_1,dir,tp,bind,NONE(),dims,-1,source,dae_var_attr,comment,flowPrefix,streamPrefix);
@@ -754,6 +755,22 @@ algorithm
754755
end matchcontinue;
755756
end lowerKnownVar;
756757

758+
protected function fixParameterStartBinding
759+
input Option<DAE.Exp> bind;
760+
input Option<DAE.VariableAttributes> attr;
761+
input BackendDAE.VarKind kind;
762+
output Option<DAE.Exp> outBind;
763+
algorithm
764+
outBind := matchcontinue (bind,attr,kind)
765+
local
766+
DAE.Exp exp;
767+
case (NONE(),attr,BackendDAE.PARAM())
768+
equation
769+
exp = DAEUtil.getStartAttr(attr);
770+
then SOME(exp);
771+
else bind;
772+
end matchcontinue;
773+
end fixParameterStartBinding;
757774

758775
protected function lowerVarkind
759776
"function: lowerVarkind

Compiler/FrontEnd/Ceval.mo

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5119,11 +5119,11 @@ algorithm
51195119
fail();
51205120

51215121
// failure in lookup but NO_MSG, silently fail and move along
5122-
case (cache,env,c,(impl as false),NO_MSG())
5122+
/*case (cache,env,c,(impl as false),NO_MSG())
51235123
equation
51245124
failure((_,_,_,_,_,_,_,_,_) = Lookup.lookupVar(cache,env, c));
51255125
then
5126-
fail();
5126+
fail();*/
51275127
end matchcontinue;
51285128
end cevalCref;
51295129

@@ -5139,7 +5139,7 @@ public function cevalCref2
51395139
output Env.Cache outCache;
51405140
output Values.Value outValue;
51415141
algorithm
5142-
(outCache, outValue) := matchcontinue(inCache, inEnv, inCref, inBinding, constForRange, inImpl, inMsg)
5142+
(outCache, outValue) := match (inCache, inEnv, inCref, inBinding, constForRange, inImpl, inMsg)
51435143
local
51445144
Env.Cache cache;
51455145
Values.Value v;
@@ -5162,12 +5162,11 @@ algorithm
51625162
// A variable with a binding -> constant evaluate the binding
51635163
case (_, _, _, _, _, _, _)
51645164
equation
5165-
failure(equality(inBinding = DAE.UNBOUND()));
51665165
false = crefEqualValue(inCref, inBinding);
51675166
(cache, v) = cevalCrefBinding(inCache, inEnv, inCref, inBinding, inImpl, inMsg);
51685167
then
51695168
(cache, v);
5170-
end matchcontinue;
5169+
end match;
51715170
end cevalCref2;
51725171

51735172
public function cevalCrefBinding "function: cevalCrefBinding
@@ -5597,19 +5596,16 @@ protected function crefEqualValue ""
55975596
input DAE.Binding v;
55985597
output Boolean outBoolean;
55995598
algorithm
5600-
outBoolean := matchcontinue(c,v)
5599+
outBoolean := match (c,v)
56015600
local
56025601
DAE.ComponentRef cr;
56035602

56045603
case(c,(v as DAE.EQBOUND(DAE.CREF(cr,_),NONE(),_,_)))
5605-
equation
5606-
true = ComponentReference.crefEqual(c,cr);
5607-
then
5608-
true;
5604+
then ComponentReference.crefEqual(c,cr);
56095605

5610-
case(_,_) then false;
5606+
else false;
56115607

5612-
end matchcontinue;
5608+
end match;
56135609
end crefEqualValue;
56145610

56155611
protected function dimensionSliceInRange "

0 commit comments

Comments
 (0)