Skip to content

Commit

Permalink
- Annotations in between equation items are now preserved in SCode.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4442 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Stefan Brus committed Oct 30, 2009
1 parent 3981286 commit 6196edd
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Compiler/SCode.mo
Expand Up @@ -767,6 +767,7 @@ algorithm
list<Annotation> anns,anns1,anns2;
list<Absyn.ElementItem> eilst;
list<Absyn.ClassPart> cdr;
list<Absyn.EquationItem> eqilst;
case({}) then {};
case(Absyn.PUBLIC(eilst) :: cdr)
equation
Expand All @@ -782,6 +783,20 @@ algorithm
anns2 = listAppend(anns,anns1);
then
anns2;
case(Absyn.EQUATIONS(eqilst) :: cdr)
equation
anns = elabAnnotationsEq(eqilst);
anns1 = elabClassdefAnnotations(cdr);
anns2 = listAppend(anns,anns1);
then
anns2;
case(Absyn.INITIALEQUATIONS(eqilst) :: cdr)
equation
anns = elabAnnotationsEq(eqilst);
anns1 = elabClassdefAnnotations(cdr);
anns2 = listAppend(anns,anns1);
then
anns2;
case(_ :: cdr)
equation
anns = elabClassdefAnnotations(cdr);
Expand Down Expand Up @@ -1015,6 +1030,40 @@ algorithm
end matchcontinue;
end elabAnnotations;

// stefan
protected function elabAnnotationsEq
"function: elabAnnotations
turns a list of Absyn.EquationItem into a list of Annotations"
input list<Absyn.EquationItem> inEquationItemList;
output list<Annotation> outAnnotationList;
algorithm
outAnnotationList := matchcontinue(inEquationItemList)
local
list<Absyn.EquationItem> cdr;
Absyn.Annotation ann;
Annotation res;
list<Annotation> anns,anns_1;
case({}) then {};
case(Absyn.EQUATIONITEMANN(ann) :: cdr)
equation
res = elabAnnotation(ann);
anns = elabAnnotationsEq(cdr);
anns_1 = res :: anns;
then
anns_1;
case(_ :: cdr)
equation
anns = elabAnnotationsEq(cdr);
then
anns;
case(_)
equation
Debug.fprintln("failtrace","SCode.elabAnnotationsEq failed");
then
fail();
end matchcontinue;
end elabAnnotationsEq;

// stefan
protected function elabAnnotation
"function: elabAnnotation
Expand Down

0 comments on commit 6196edd

Please sign in to comment.