Skip to content

Commit

Permalink
- Fix ThermoPower tests.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25176 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Mar 20, 2015
1 parent d2570c4 commit 27c2636
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -12127,5 +12127,29 @@ algorithm
end match;
end isScalar;

public function containsAnyCall
"Returns true if the given expression contains any function calls,
otherwise false."
input DAE.Exp inExp;
output Boolean outContainsCall;
algorithm
(_, outContainsCall) := traverseExpTopDown(inExp, containsAnyCall_traverser, false);
end containsAnyCall;

protected function containsAnyCall_traverser
input DAE.Exp inExp;
input Boolean inContainsCall;
output DAE.Exp outExp = inExp;
output Boolean outContinue;
output Boolean outContainsCall;
algorithm
outContainsCall := match inExp
case DAE.CALL() then true;
else inContainsCall;
end match;

outContinue := not outContainsCall;
end containsAnyCall_traverser;

annotation(__OpenModelica_Interface="frontend");
end Expression;
7 changes: 5 additions & 2 deletions Compiler/FrontEnd/Mod.mo
Expand Up @@ -430,8 +430,11 @@ algorithm
(_, v) := Ceval.ceval(inCache, inEnv, inExp, false, NONE(), msg, 0);
outValue := SOME(v);
else
// Fail if ceval gave an error.
if err_count <> Error.getNumErrorMessages() then
// Fail if ceval gave an error. Except if the expression contains a
// function call, because we don't handle function parameter modifiers
// correctly which causes issues with CevalFunction.
if err_count <> Error.getNumErrorMessages() and not
Expression.containsAnyCall(inExp) then
fail();
end if;
end try;
Expand Down

0 comments on commit 27c2636

Please sign in to comment.