@@ -100,6 +100,7 @@ import InstSettings = NFInst.InstSettings;
100100import Testsuite ;
101101import MetaModelica.Dangerous.listReverseInPlace ;
102102
103+ constant InstContext . Type ANNOTATION_CONTEXT = intBitOr(NFInstContext . RELAXED , NFInstContext . ANNOTATION );
103104
104105public
105106function evaluateAnnotation
@@ -154,12 +155,9 @@ protected
154155 DAE . DAElist dae;
155156 Type ty;
156157 Variability var ;
157- InstContext . Type context;
158158algorithm
159159 stringLst := {};
160-
161160 Absyn . ANNOTATION (el) := inAnnotation;
162- context := InstContext . set(NFInstContext . RELAXED , NFInstContext . ANNOTATION );
163161
164162 for e in listReverse(el) loop
165163
@@ -180,8 +178,8 @@ algorithm
180178 (program, name, inst_cls) := frontEndFront(absynProgram, classPath);
181179 end if ;
182180
183- exp := NFInst . instExp(absynExp, inst_cls, context , info);
184- (exp, ty, var ) := Typing . typeExp(exp, context , info);
181+ exp := NFInst . instExp(absynExp, inst_cls, ANNOTATION_CONTEXT , info);
182+ (exp, ty, var ) := Typing . typeExp(exp, ANNOTATION_CONTEXT , info);
185183 // exp := NFCeval.evalExp(exp);
186184 exp := SimplifyExp . simplify(exp);
187185 str := Expression . toString(exp);
@@ -205,14 +203,13 @@ algorithm
205203 (stripped_mod, graphics_mod) := AbsynUtil . stripGraphicsAndInteractionModification(mod);
206204
207205 smod := AbsynToSCode . translateMod(SOME (Absyn . CLASSMOD (stripped_mod, Absyn . NOMOD ())), SCode . NOT_FINAL (), SCode . NOT_EACH (), info);
208- anncls := Lookup . lookupClassName(Absyn . IDENT (annName), inst_cls, context , AbsynUtil . dummyInfo, checkAccessViolations = false );
206+ anncls := Lookup . lookupClassName(Absyn . IDENT (annName), inst_cls, ANNOTATION_CONTEXT , AbsynUtil . dummyInfo, checkAccessViolations = false );
209207 inst_anncls := NFInst . expand(anncls);
210- inst_anncls := NFInst . instClass(inst_anncls, Modifier . create(smod, annName, ModifierScope . CLASS (annName), inst_cls), NFAttributes . DEFAULT_ATTR , true , 0 , inst_cls, context);
211-
208+ inst_anncls := NFInst . instClass(inst_anncls, Modifier . create(smod, annName, ModifierScope . CLASS (annName), inst_cls), NFAttributes . DEFAULT_ATTR , true , 0 , inst_cls, ANNOTATION_CONTEXT );
212209 // Instantiate expressions (i.e. anything that can contains crefs, like
213210 // bindings, dimensions, etc). This is done as a separate step after
214211 // instantiation to make sure that lookup is able to find the correct nodes.
215- NFInst . instExpressions(inst_anncls, context = context );
212+ NFInst . instExpressions(inst_anncls, context = ANNOTATION_CONTEXT );
216213
217214 // Mark structural parameters.
218215 NFInst . updateImplicitVariability(inst_anncls, Flags . isSet(Flags . EVAL_PARAM ));
@@ -223,8 +220,8 @@ algorithm
223220 if (listMember(annName, {"Icon" , "Diagram" , "choices" })) and not listEmpty(graphics_mod) then
224221 try
225222 {Absyn . MODIFICATION (modification = SOME (Absyn . CLASSMOD (eqMod = Absyn . EQMOD (exp = absynExp))))} := graphics_mod;
226- exp := NFInst . instExp(absynExp, inst_cls, context , info);
227- (exp, ty, var ) := Typing . typeExp(exp, context , info);
223+ exp := NFInst . instExp(absynExp, inst_cls, ANNOTATION_CONTEXT , info);
224+ (exp, ty, var ) := Typing . typeExp(exp, ANNOTATION_CONTEXT , info);
228225 save := exp;
229226 try
230227 exp := NFCeval . evalExp(save);
@@ -247,14 +244,13 @@ algorithm
247244 (program, top) := mkTop(absynProgram, annName);
248245 inst_cls := top;
249246
250- anncls := Lookup . lookupClassName(Absyn . IDENT (annName), inst_cls, context, AbsynUtil . dummyInfo, checkAccessViolations = false );
251-
252- inst_anncls := NFInst . instantiate(anncls, context = context);
247+ anncls := Lookup . lookupClassName(Absyn . IDENT (annName), inst_cls, ANNOTATION_CONTEXT , AbsynUtil . dummyInfo, checkAccessViolations = false );
253248
249+ inst_anncls := NFInst . instantiate(anncls, context = ANNOTATION_CONTEXT );
254250 // Instantiate expressions (i.e. anything that can contains crefs, like
255251 // bindings, dimensions, etc). This is done as a separate step after
256252 // instantiation to make sure that lookup is able to find the correct nodes.
257- NFInst . instExpressions(inst_anncls, context = context );
253+ NFInst . instExpressions(inst_anncls, context = ANNOTATION_CONTEXT );
258254
259255 // Mark structural parameters.
260256 NFInst . updateImplicitVariability(inst_anncls, Flags . isSet(Flags . EVAL_PARAM ));
@@ -339,10 +335,7 @@ protected
339335 Type ty;
340336 Variability var ;
341337 Option < Absyn . Comment > cmt;
342- InstContext . Type context;
343338algorithm
344- context := InstContext . set(NFInstContext . RELAXED , NFInstContext . ANNOTATION );
345-
346339 // handle the annotations
347340 for i in inElements loop
348341 elArgs := matchcontinue i
@@ -1766,8 +1759,8 @@ algorithm
17661759 ErrorExt . setCheckpoint(getInstanceName());
17671760
17681761 try
1769- binding_exp := Inst . instExp(absyn_binding, scope, NFInstContext . ANNOTATION , mod. info);
1770- binding_exp := Typing . typeExp(binding_exp, NFInstContext . ANNOTATION , mod. info);
1762+ binding_exp := Inst . instExp(absyn_binding, scope, ANNOTATION_CONTEXT , mod. info);
1763+ binding_exp := Typing . typeExp(binding_exp, ANNOTATION_CONTEXT , mod. info);
17711764 binding_exp := SimplifyExp . simplify(binding_exp);
17721765 json := JSON . addPair(name, Expression . toJSON(binding_exp), json);
17731766 else
0 commit comments