@@ -851,7 +851,7 @@ algorithm
851851 case (cache,_,"getClassInformation" ,_,st,_)
852852 then (cache,Values . TUPLE ({Values . STRING ("" ),Values . STRING ("" ),Values . BOOL (false ),Values . BOOL (false ),Values . BOOL (false ),Values . STRING ("" ),
853853 Values . BOOL (false ),Values . INTEGER (0 ),Values . INTEGER (0 ),Values . INTEGER (0 ),Values . INTEGER (0 ),Values . ARRAY ({},{0 }),
854- Values . BOOL (false ),Values . BOOL (false ),Values . STRING ("" ),Values . STRING ("" )}),st);
854+ Values . BOOL (false ),Values . BOOL (false ),Values . STRING ("" ),Values . STRING ("" ), Values . BOOL ( false ) }),st);
855855
856856 case (cache,_,"diffModelicaFileListings" ,{Values . STRING (s1),Values . STRING (s2),Values . ENUM_LITERAL (name= path)},(st as GlobalScript . SYMBOLTABLE (ast = p)),_)
857857 algorithm
@@ -6526,6 +6526,44 @@ algorithm
65266526 System . writeFile(filename, str + str1);
65276527end saveTotalModel;
65286528
6529+ protected function getDymolaStateAnnotation
6530+ "Returns the __Dymola_state annotation of a class.
6531+ This is annotated with the annotation:
6532+ annotation (__Dymola_state=true); in the class definition"
6533+ input Absyn . Path className;
6534+ input Absyn . Program p;
6535+ output Boolean isState;
6536+ algorithm
6537+ isState := match(className,p)
6538+ local
6539+ String stateStr;
6540+ case (_,_)
6541+ equation
6542+ stateStr = Interactive . getNamedAnnotation(className, p, Absyn . IDENT ("__Dymola_state" ), SOME ("false" ), getDymolaStateAnnotationModStr);
6543+ then
6544+ stringEq(stateStr, "true" );
6545+ end match;
6546+ end getDymolaStateAnnotation;
6547+
6548+ protected function getDymolaStateAnnotationModStr
6549+ "Extractor function for getDocumentationClassAnnotation"
6550+ input Option < Absyn . Modification > mod;
6551+ output String stateStr;
6552+ algorithm
6553+ stateStr := matchcontinue(mod)
6554+ local Absyn . Exp e;
6555+
6556+ case (SOME (Absyn . CLASSMOD (eqMod = Absyn . EQMOD (exp= e))))
6557+ equation
6558+ stateStr = Dump . printExpStr(e);
6559+ then
6560+ stateStr;
6561+
6562+ else "false" ;
6563+
6564+ end matchcontinue;
6565+ end getDymolaStateAnnotationModStr;
6566+
65296567protected function getClassInformation
65306568"author: PA
65316569 Returns all the possible class information.
@@ -6540,7 +6578,7 @@ protected function getClassInformation
65406578protected
65416579 String name,file,strPartial,strFinal,strEncapsulated,res,cmt,str_readonly,str_sline,str_scol,str_eline,str_ecol,version,preferredView;
65426580 String dim_str,lastIdent;
6543- Boolean partialPrefix,finalPrefix,encapsulatedPrefix,isReadOnly,isProtectedClass,isDocClass;
6581+ Boolean partialPrefix,finalPrefix,encapsulatedPrefix,isReadOnly,isProtectedClass,isDocClass,isState ;
65446582 Absyn . Restriction restr;
65456583 Absyn . ClassDef cdef;
65466584 Integer sl,sc,el,ec;
@@ -6560,6 +6598,7 @@ algorithm
65606598 isDocClass := Interactive . getDocumentationClassAnnotation(path, p);
65616599 version := CevalScript . getPackageVersion(path, p);
65626600 Absyn . STRING (preferredView) := Interactive . getNamedAnnotation(path, p, Absyn . IDENT ("preferredView" ), SOME (Absyn . STRING ("" )), Interactive . getAnnotationExp);
6601+ isState := getDymolaStateAnnotation(path, p);
65636602 res_1 := Values . TUPLE ({
65646603 Values . STRING (res),
65656604 Values . STRING (cmt),
@@ -6576,7 +6615,8 @@ algorithm
65766615 Values . BOOL (isProtectedClass),
65776616 Values . BOOL (isDocClass),
65786617 Values . STRING (version),
6579- Values . STRING (preferredView)
6618+ Values . STRING (preferredView),
6619+ Values . BOOL (isState)
65806620 });
65816621end getClassInformation;
65826622
0 commit comments