Skip to content

Commit

Permalink
- BackendDAECreate: Add start-binding as eq-binding of parameters wit…
Browse files Browse the repository at this point in the history
…hout binding.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7624 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 2, 2011
1 parent d6f3799 commit fa268c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
17 changes: 17 additions & 0 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -742,6 +742,7 @@ algorithm
absynCommentOption = comment))
equation
kind_1 = lowerKnownVarkind(kind, name, dir, flowPrefix);
bind = fixParameterStartBinding(bind,dae_var_attr,kind_1);
tp = lowerType(t);
then
BackendDAE.VAR(name,kind_1,dir,tp,bind,NONE(),dims,-1,source,dae_var_attr,comment,flowPrefix,streamPrefix);
Expand All @@ -754,6 +755,22 @@ algorithm
end matchcontinue;
end lowerKnownVar;

protected function fixParameterStartBinding
input Option<DAE.Exp> bind;
input Option<DAE.VariableAttributes> attr;
input BackendDAE.VarKind kind;
output Option<DAE.Exp> outBind;
algorithm
outBind := matchcontinue (bind,attr,kind)
local
DAE.Exp exp;
case (NONE(),attr,BackendDAE.PARAM())
equation
exp = DAEUtil.getStartAttr(attr);
then SOME(exp);
else bind;
end matchcontinue;
end fixParameterStartBinding;

protected function lowerVarkind
"function: lowerVarkind
Expand Down
20 changes: 8 additions & 12 deletions Compiler/FrontEnd/Ceval.mo
Expand Up @@ -5119,11 +5119,11 @@ algorithm
fail();

// failure in lookup but NO_MSG, silently fail and move along
case (cache,env,c,(impl as false),NO_MSG())
/*case (cache,env,c,(impl as false),NO_MSG())
equation
failure((_,_,_,_,_,_,_,_,_) = Lookup.lookupVar(cache,env, c));
then
fail();
fail();*/
end matchcontinue;
end cevalCref;

Expand All @@ -5139,7 +5139,7 @@ public function cevalCref2
output Env.Cache outCache;
output Values.Value outValue;
algorithm
(outCache, outValue) := matchcontinue(inCache, inEnv, inCref, inBinding, constForRange, inImpl, inMsg)
(outCache, outValue) := match (inCache, inEnv, inCref, inBinding, constForRange, inImpl, inMsg)
local
Env.Cache cache;
Values.Value v;
Expand All @@ -5162,12 +5162,11 @@ algorithm
// A variable with a binding -> constant evaluate the binding
case (_, _, _, _, _, _, _)
equation
failure(equality(inBinding = DAE.UNBOUND()));
false = crefEqualValue(inCref, inBinding);
(cache, v) = cevalCrefBinding(inCache, inEnv, inCref, inBinding, inImpl, inMsg);
then
(cache, v);
end matchcontinue;
end match;
end cevalCref2;

public function cevalCrefBinding "function: cevalCrefBinding
Expand Down Expand Up @@ -5597,19 +5596,16 @@ protected function crefEqualValue ""
input DAE.Binding v;
output Boolean outBoolean;
algorithm
outBoolean := matchcontinue(c,v)
outBoolean := match (c,v)
local
DAE.ComponentRef cr;

case(c,(v as DAE.EQBOUND(DAE.CREF(cr,_),NONE(),_,_)))
equation
true = ComponentReference.crefEqual(c,cr);
then
true;
then ComponentReference.crefEqual(c,cr);

case(_,_) then false;
else false;

end matchcontinue;
end match;
end crefEqualValue;

protected function dimensionSliceInRange "
Expand Down

0 comments on commit fa268c2

Please sign in to comment.