Skip to content

Commit

Permalink
equationNth1: removed matchcontinue
Browse files Browse the repository at this point in the history
  • Loading branch information
vruge authored and OpenModelica-Hudson committed Feb 15, 2016
1 parent bc07b69 commit fdebf71
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -1537,25 +1537,20 @@ public function equationNth1 "author: PA
input BackendDAE.EquationArray inEquationArray;
input Integer inPos "one-based indexing";
output BackendDAE.Equation outEquation;
protected
Integer n;
array<Option<BackendDAE.Equation>> arr;
String str;
algorithm
outEquation := matchcontinue (inEquationArray, inPos)
local
BackendDAE.Equation e;
Integer n;
array<Option<BackendDAE.Equation>> arr;
String str;

case (BackendDAE.EQUATION_ARRAY(numberOfElement=n, equOptArr=arr), _) equation
true = intLe(inPos, n);
SOME(e) = arr[inPos];
then e;

case (BackendDAE.EQUATION_ARRAY(numberOfElement=n), _) equation
str = "BackendEquation.equationNth1 failed; numberOfElement=" + intString(n) + "; pos=" + intString(inPos);
print(str + "\n");
Error.addInternalError(str, sourceInfo());
then fail();
end matchcontinue;
BackendDAE.EQUATION_ARRAY(numberOfElement=n, equOptArr=arr) := inEquationArray;
if intLe(inPos, n) then
outEquation := Util.getOption(arr[inPos]);
else
str := "BackendEquation.equationNth1 failed; numberOfElement=" + intString(n) + "; pos=" + intString(inPos);
print(str + "\n");
Error.addInternalError(str, sourceInfo());
fail();
end if;
end equationNth1;

public function equationNthSize
Expand Down

0 comments on commit fdebf71

Please sign in to comment.