Skip to content

Commit

Permalink
-Fixed so MISSING_INNER_MESSAGE error is not produced if option "chec…
Browse files Browse the repository at this point in the history
…kModel" is true. This option should preferably be set when instantiating class for checkModel.

git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@4091 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jun 18, 2009
1 parent 76545d0 commit bf8cb72
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Compiler/Error.mo
Expand Up @@ -468,7 +468,7 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
(UNUSED_MODIFIER,TRANSLATION(),WARNING(),
"Modifer declared but never used: %s %s"),
(MISSING_INNER_PREFIX,TRANSLATION(),ERROR(),
"No corresponding 'INNER' declaration found for component %s declared as '%s'."),
"No corresponding 'inner' declaration found for component %s declared as '%s'."),
(DERIVATIVE_NON_REAL,TRANSLATION(),ERROR(),
"Illegal derivative. der(%s) where %s is of type %s, which is not a subtype of Real"),
(IMPLICIT_ITERATOR_NOT_FOUND_IN_LOOP_BODY,TRANSLATION(),ERROR(),
Expand Down
22 changes: 19 additions & 3 deletions Compiler/Inst.mo
Expand Up @@ -12798,16 +12798,32 @@ algorithm
case(DAE.VAR(componentRef=cr, innerOuter = io),innerVars)
local Absyn.InnerOuter io;
equation
str2 = SCode.innerouterString(io);
str2 = Dump.unparseInnerouterStr(io);
crs = Util.listMap(innerVars,DAE.varCref);
{} = Util.listSelect1(crs, cr,isInnerOuterMatch);
str = Exp.printComponentRefStr(cr);
Error.addMessage(Error.MISSING_INNER_PREFIX,{str,str2});
print(" error: " +& str +& "\n");
then fail();
failExceptForCheck();
then ();
end matchcontinue;
end checkMissingInnerDecl2;

public function failExceptForCheck "function that fails if checkModel option is not set, otherwise it succeeds

It should be used for the cases when normal instantiation should fail but a instantiation for performing
checkModel call should not fail
"
algorithm
_ := matchcontinue()
case() equation
true = OptManager.getOption("checkModel");
then ();
case() equation
//false = OptManager.getOption("checkModel");
then fail();
end matchcontinue;
end failExceptForCheck;

protected function extractCurrentName "Function: extractCurrentName
Extract SCode.Element name.
"
Expand Down
1 change: 1 addition & 0 deletions Compiler/runtime/optmanager.cpp
Expand Up @@ -69,6 +69,7 @@ extern "C"
options.insert(std::pair<std::string,bool>("analyticJacobian",false));
options.insert(std::pair<std::string,bool>("dummyOption",false));
options.insert(std::pair<std::string,bool>("logSelectedStates",false));
options.insert(std::pair<std::string,bool>("checkModel",false));

//options.insert(std::pair<std::string,bool>("dummy",false));

Expand Down

0 comments on commit bf8cb72

Please sign in to comment.