Skip to content

Commit

Permalink
Fixed elaboration of built-in function 'integer' when the argument is an
Browse files Browse the repository at this point in the history
Integer.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4926 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Feb 5, 2010
1 parent a449c96 commit d3b57e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Compiler/Static.mo
Expand Up @@ -4932,10 +4932,12 @@ algorithm
Env.Cache cache;
DAE.Properties prop;
DAE.DAElist dae;

DAE.Type ty;
String exp_str;
case (cache,env,{s1},_,impl)
equation
(cache,s1_1,prop,dae) = verifyBuiltInHandlerType(cache,env,{s1},impl,Types.isRealOrSubTypeReal,"integer");
(cache,s1_1,prop,dae) =
verifyBuiltInHandlerType(cache,env,{s1},impl,Types.isIntegerOrRealOrSubTypeOfEither,"integer");
then
(cache,s1_1,prop,dae);
end matchcontinue;
Expand Down
12 changes: 12 additions & 0 deletions Compiler/Types.mo
Expand Up @@ -597,6 +597,18 @@ algorithm b := matchcontinue(inType)
end matchcontinue;
end isIntegerOrSubTypeInteger;

public function isIntegerOrRealOrSubTypeOfEither
"Checks if a type is either some Integer or Real type."
input Type t;
output Boolean b;
algorithm
b := matchcontinue(t)
case(_) equation true = isRealOrSubTypeReal(t); then true;
case(_) equation true = isIntegerOrSubTypeInteger(t); then true;
case(_) then false;
end matchcontinue;
end isIntegerOrRealOrSubTypeOfEither;

public function isInteger "Returns true if type is Integer"
input Type tp;
output Boolean res;
Expand Down

0 comments on commit d3b57e1

Please sign in to comment.