Skip to content

Commit

Permalink
- Some case merging and various improvements.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23049 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Oct 29, 2014
1 parent 36d0f70 commit 38435b1
Show file tree
Hide file tree
Showing 6 changed files with 471 additions and 643 deletions.
32 changes: 6 additions & 26 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -4149,18 +4149,11 @@ public function dimensionsAdd
input DAE.Dimension dim2;
output DAE.Dimension res;
algorithm
res := matchcontinue(dim1, dim2)
local
DAE.Exp e1, e2;

case (_, _)
equation
res = intDimension(dimensionSize(dim1) + dimensionSize(dim2));
then
res;

else DAE.DIM_UNKNOWN();
end matchcontinue;
try
res := intDimension(dimensionSize(dim1) + dimensionSize(dim2));
else
res := DAE.DIM_UNKNOWN();
end try;
end dimensionsAdd;

public function concatArrayType
Expand Down Expand Up @@ -11096,19 +11089,6 @@ algorithm
end match;
end expandDimension;

protected function makeIntegerSubscript
"Generates an integer subscript. For use with List.generate."
input Integer inIndex;
output Integer outNextIndex;
output DAE.Subscript outSubscript;
output Boolean outContinue;
algorithm
(outNextIndex, outSubscript, outContinue) := match(inIndex)
case 0 then (0, DAE.WHOLEDIM(), false);
else (inIndex - 1, DAE.INDEX(DAE.ICONST(inIndex)), true);
end match;
end makeIntegerSubscript;

protected function expandSlice
"Expands a slice subscript expression."
input DAE.Exp inSliceExp;
Expand Down Expand Up @@ -11145,7 +11125,7 @@ public function dimensionSizeSubscripts
input Integer inDimSize;
output list<DAE.Subscript> outSubscripts;
algorithm
outSubscripts := List.generateReverse(inDimSize, makeIntegerSubscript);
outSubscripts := list(DAE.INDEX(DAE.ICONST(i)) for i in 1:inDimSize);
end dimensionSizeSubscripts;

annotation(__OpenModelica_Interface="frontend");
Expand Down
10 changes: 10 additions & 0 deletions Compiler/FrontEnd/PrefixUtil.mo
Expand Up @@ -1342,5 +1342,15 @@ algorithm
end matchcontinue;
end prefixDimensions;

public function isNoPrefix
input Prefix.Prefix inPrefix;
output Boolean outIsEmpty;
algorithm
outIsEmpty := match(inPrefix)
case Prefix.NOPRE() then true;
else false;
end match;
end isNoPrefix;

annotation(__OpenModelica_Interface="frontend");
end PrefixUtil;

0 comments on commit 38435b1

Please sign in to comment.