Skip to content

Commit

Permalink
- Add a function that checks weather the referenced class has the res…
Browse files Browse the repository at this point in the history
…triction

   \"Optimization\" or not

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15380 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Alachew Mengist committed Feb 28, 2013
1 parent 36a8fcb commit 9bffeaa
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Compiler/Script/Interactive.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,14 @@ algorithm
resstr = boolString(b1);
then
(resstr,st);
case (istmts, st as SYMBOLTABLE(ast = p))
equation
matchApiFunction(istmts, "isOptimization");
{Absyn.CREF(componentRef = cr)} = getApiFunctionArgs(istmts);
b1 = isOptimization(cr, p);
resstr = boolString(b1);
then
(resstr,st);

case (istmts, st as SYMBOLTABLE(ast = p))
equation
Expand Down Expand Up @@ -8754,6 +8762,31 @@ algorithm
end matchcontinue;
end isBlock;

protected function isOptimization
"function: isOptimization
This function takes a component reference and a program.
It returns true if the refrenced class has the restriction
\"Optimization\", otherwise it returns false."
input Absyn.ComponentRef inComponentRef;
input Absyn.Program inProgram;
output Boolean outBoolean;
algorithm
outBoolean:=
matchcontinue (inComponentRef,inProgram)
local
Absyn.Path path;
Absyn.ComponentRef cr;
Absyn.Program p;
case (cr,p)
equation
path = Absyn.crefToPath(cr);
Absyn.CLASS(_,_,_,_,Absyn.R_OPTIMIZATION(),_,_) = getPathedClassInProgram(path, p);
then
true;
case (cr,p) then false;
end matchcontinue;
end isOptimization;

public function isFunction
"function: isFunction
This function takes a component reference and a program.
Expand Down

0 comments on commit 9bffeaa

Please sign in to comment.