Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Disabled error message from Ceval when constant evaluating parameters in Mod.elabModValue.
- Changed some tests that no longer gets these error messages.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5411 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Apr 28, 2010
1 parent ec52821 commit 952cce9
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions Compiler/Mod.mo
Expand Up @@ -318,32 +318,21 @@ protected function elabModValue
algorithm
(outCache,outValuesValueOption) :=
matchcontinue (inCache,inEnv,inExp,inProp)
local
Values.Value v;
list<Env.Frame> env;
DAE.Exp e;
Env.Cache cache;
DAE.Properties prop;
DAE.Const const;
// Don't constant evaluate parameters with fixed = false
case (cache,env,e,prop as DAE.PROP(type_ = ty))
case (_,_,_,_)
local
DAE.Type ty;
equation
DAE.C_PARAM() = Types.propAllConst(prop);
false = Types.getFixedVarAttribute(ty);
then (cache, NONE);
// evaluate ONLY constants and parameters
case (cache,env,e,prop)
Values.Value v;
Ceval.Msg msg;
Env.Cache cache;
equation
// const = Types.propAllConst(prop) "Don't ceval variables";
// true = listMember(const, {DAE.C_CONST(),DAE.C_PARAM()});
// now which one is faster?
failure(DAE.C_VAR() = Types.propAllConst(prop)) "Don't ceval variables";
(cache,v,_) = Ceval.ceval(cache,env, e, false, NONE, NONE, Ceval.MSG());
// Don't ceval variables.
failure(DAE.C_VAR() = Types.propAllConst(inProp));
// Show error messages from ceval only if the expression is not a parameter.
msg = Util.if_(Util.equal(DAE.C_PARAM(), Types.propAllConst(inProp)), Ceval.NO_MSG(), Ceval.MSG());
(cache,v,_) = Ceval.ceval(inCache, inEnv, inExp, false, NONE, NONE, msg);
then
(cache,SOME(v));
case (cache,_,_,_) then (cache,NONE);
// Constant evaluation failed, return no value.
case (_,_,_,_) then (inCache, NONE);
end matchcontinue;
end elabModValue;

Expand Down

0 comments on commit 952cce9

Please sign in to comment.