Skip to content

Commit

Permalink
Propagate unit checking to the DAE
Browse files Browse the repository at this point in the history
This fixes some of the issues in ticket:4526. displayUnit is not
considered.

Belonging to [master]:
  - OpenModelica/OMCompiler#2104
  - OpenModelica/OpenModelica-testsuite#819
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jan 12, 2018
1 parent 92c6383 commit e46b837
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Compiler/FrontEnd/Inst.mo
Expand Up @@ -327,9 +327,9 @@ algorithm

// instantiate a class
case (cache,ih,cdecls as _::_,path)
equation
(outCache,outEnv,outIH,outDAElist) = instantiateClass_dispatch(cache,ih,cdecls,path,doSCodeDep);
NFUnitCheck.checkUnits(outDAElist,FCore.getFunctionTree(outCache));
algorithm
(outCache,outEnv,outIH,outDAElist) := instantiateClass_dispatch(cache,ih,cdecls,path,doSCodeDep);
outDAElist := NFUnitCheck.checkUnits(outDAElist,FCore.getFunctionTree(outCache));
then
(outCache,outEnv,outIH,outDAElist);

Expand Down
7 changes: 4 additions & 3 deletions Compiler/NFFrontEnd/NFUnitCheck.mo
Expand Up @@ -43,8 +43,9 @@ end Functionargs;
public function checkUnits
input DAE.DAElist inDAE;
input DAE.FunctionTree func;
output DAE.DAElist outDAE = inDAE;
protected
DAE.DAElist elts1, elts2, elts3;
DAE.DAElist elts1, elts2;
list<DAE.Element> eqlist, varlist, newdaelist;
list<DAE.Function> functionlist;
list<Functionargs> args;
Expand Down Expand Up @@ -76,13 +77,13 @@ algorithm
HtCr2U2 := BaseHashTable.copy(HtCr2U1);
((HtCr2U2, HtS2U, HtU2S)) := algo(varlist, eqlist, args, HtCr2U2, HtS2U, HtU2S);
varlist := List.map2(varlist, returnVar, HtCr2U2, HtU2S);
newdaelist := List.append_reverse(varlist, eqlist);
newdaelist := listAppend(varlist, eqlist);
if Flags.isSet(Flags.DUMP_UNIT) then
BaseHashTable.dumpHashTable(HtCr2U2);
print("######## UnitCheck COMPLETED ########\n");
end if;
notification(HtCr2U1, HtCr2U2, HtU2S);
elts3 := updateDAElist(inDAE, listReverse(newdaelist));
outDAE := updateDAElist(inDAE, newdaelist);
else
Error.addInternalError(getInstanceName() + ": unit check module failed", sourceInfo());
end try;
Expand Down

0 comments on commit e46b837

Please sign in to comment.