@@ -6284,7 +6284,37 @@ protected function addClassdefsToEnv2
62846284 output Env.Env outEnv;
62856285 output InstanceHierarchy outIH;
62866286algorithm
6287- (outEnv,outIH) := matchcontinue (inEnv,inIH,inPrefix,inSCodeElementLst,inBoolean,redeclareMod)
6287+ (outEnv,outIH) := match (inEnv,inIH,inPrefix,inSCodeElementLst,inBoolean,redeclareMod)
6288+ local
6289+ list<Env.Frame> env;
6290+ SCode.Element elt;
6291+ list<SCode.Element> xs;
6292+ Boolean impl;
6293+ InstanceHierarchy ih;
6294+ Prefix.Prefix pre;
6295+ case (env,ih,pre,{},_,_) then (env,ih);
6296+ case (env,ih,pre,elt::xs,impl,_)
6297+ equation
6298+ (env,ih) = addClassdefToEnv2(env,ih,inPrefix,elt,inBoolean,redeclareMod);
6299+ (env,ih) = addClassdefsToEnv2(env,ih,inPrefix,xs,inBoolean,redeclareMod);
6300+ then (env,ih);
6301+ end match;
6302+ end addClassdefsToEnv2;
6303+
6304+ protected function addClassdefToEnv2
6305+ "function: addClassdefToEnv2
6306+ author: PA
6307+ Helper relation to addClassdefsToEnv"
6308+ input Env.Env inEnv;
6309+ input InstanceHierarchy inIH;
6310+ input Prefix.Prefix inPrefix;
6311+ input SCode.Element inSCodeElement;
6312+ input Boolean inBoolean;
6313+ input Option<DAE.Mod> redeclareMod;
6314+ output Env.Env outEnv;
6315+ output InstanceHierarchy outIH;
6316+ algorithm
6317+ (outEnv,outIH) := matchcontinue (inEnv,inIH,inPrefix,inSCodeElement,inBoolean,redeclareMod)
62886318 local
62896319 list<Env.Frame> env,env_1,env_2;
62906320 SCode.Element cl2, enumclass, imp;
@@ -6299,86 +6329,77 @@ algorithm
62996329 Option<SCode.Comment> cmt;
63006330 SCode.Replaceable rpp;
63016331
6302- case (env,ih,pre,{},_,_) then (env,ih);
6303-
63046332 // we have a redeclaration of an enumeration.
6305- case (env,ih,pre,( (sel1 as SCode.CLASS(name = s, classDef=SCode.ENUMERATION(enumLst,cmt),info=info)) :: xs ),impl,SOME(_))
6333+ case (env,ih,pre,( (sel1 as SCode.CLASS(name = s, classDef=SCode.ENUMERATION(enumLst,cmt),info=info))),impl,SOME(_))
63066334 equation
63076335 enumclass = instEnumeration(s, enumLst, cmt, info);
63086336 env_1 = Env.extendFrameC(env, enumclass);
63096337 (env_1,ih,cl2) = addClassdefsToEnv3(env_1, ih, pre, redeclareMod, sel1);
63106338 ih = InnerOuter.addClass(cl2, pre, Env.getEnvNameStr(env_1), ih);
6311- (env_2,ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
63126339 then
6313- (env_2 ,ih);
6340+ (env_1 ,ih);
63146341
63156342 // we do have a redeclaration of class.
6316- case (env,ih,pre,( (sel1 as SCode.CLASS(name = s)) :: xs ),impl,SOME(_))
6343+ case (env,ih,pre,( (sel1 as SCode.CLASS(name = s))),impl,SOME(_))
63176344 equation
63186345 // extend first
63196346 env_1 = Env.extendFrameC(env, sel1);
63206347 // call to redeclareType which calls updateComponents in env wich updates the class frame
63216348 (env_1,ih,cl2) = addClassdefsToEnv3(env_1, ih, pre, redeclareMod, sel1);
63226349 ih = InnerOuter.addClass(cl2, pre, Env.getEnvNameStr(env_1), ih);
6323- (env_2,ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
63246350 then
6325- (env_2 ,ih);
6351+ (env_1 ,ih);
63266352
63276353 // we do have a replaceable class?.
6328- case (env,ih,pre,(sel1 as SCode.CLASS(name = s, prefixes = SCode.PREFIXES(replaceablePrefix = rpp))) :: xs ,impl,_)
6354+ case (env,ih,pre,(sel1 as SCode.CLASS(name = s, prefixes = SCode.PREFIXES(replaceablePrefix = rpp))),impl,_)
63296355 equation
63306356 // we have a replaceable class
63316357 true = SCode.replaceableBool(rpp);
63326358 // search first in env if we already have a redeclare definition for it!!
63336359 (_, SCode.CLASS(prefixes = SCode.PREFIXES(redeclarePrefix = SCode.REDECLARE())), _) = Lookup.lookupClass(Env.emptyCache(), env, Absyn.IDENT(s), false);
63346360 // do nothing, just move along!
6335- (env,ih) = addClassdefsToEnv2(env, ih, pre, xs, impl, redeclareMod);
63366361 then
63376362 (env,ih);
63386363
63396364 // adrpo: see if is an enumeration! then extend frame with in class.
6340- case (env,ih,pre,(sel1 as SCode.CLASS(name = s, classDef=SCode.ENUMERATION(enumLst,cmt),info=info)) :: xs ,impl,_)
6365+ case (env,ih,pre,(sel1 as SCode.CLASS(name = s, classDef=SCode.ENUMERATION(enumLst,cmt),info=info)),impl,_)
63416366 equation
63426367 enumclass = instEnumeration(s, enumLst, cmt, info);
63436368 env_1 = Env.extendFrameC(env, enumclass);
63446369 ih = InnerOuter.addClass(enumclass, pre, Env.getEnvNameStr(env_1), ih);
6345- (env_2,ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
63466370 then
6347- (env_2 ,ih);
6371+ (env_1 ,ih);
63486372
63496373 // otherwise, extend frame with in class.
6350- case (env,ih,pre,(sel1 as SCode.CLASS(classDef = _)) :: xs ,impl,_)
6374+ case (env,ih,pre,(sel1 as SCode.CLASS(classDef = _)),impl,_)
63516375 equation
63526376 // Debug.traceln("Extend frame " +& Env.printEnvPathStr(env) +& " with " +& SCode.className(cl));
63536377 env_1 = Env.extendFrameC(env, sel1);
63546378 ih = InnerOuter.addClass(sel1, pre, Env.getEnvNameStr(env_1), ih);
6355- (env_2, ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
63566379 then
6357- (env_2 ,ih);
6380+ (env_1 ,ih);
63586381
63596382 // adrpo: we should have no imports after SCodeFlatten!
63606383 // unfortunately we do because of the way we evaluate
63616384 // programs for interactive evaluation
6362- case (env,ih,pre,(imp as SCode.IMPORT(imp = _)) :: xs ,impl,_)
6385+ case (env,ih,pre,(imp as SCode.IMPORT(imp = _)),impl,_)
63636386 equation
63646387 env_1 = Env.extendFrameI(env, imp);
6365- (env_2,ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
63666388 then
6367- (env_2 ,ih);
6389+ (env_1 ,ih);
63686390
6369- case(env,ih,pre,((elt as SCode.DEFINEUNIT(name=_))::xs ), impl,_)
6391+ case(env,ih,pre,((elt as SCode.DEFINEUNIT(name=_))), impl,_)
63706392 equation
63716393 env_1 = Env.extendFrameDefunit(env,elt);
6372- (env_2,ih) = addClassdefsToEnv2(env_1, ih, pre, xs, impl, redeclareMod);
6373- then (env_2,ih);
6394+ then (env_1,ih);
63746395
63756396 case(env,ih,pre,_,_,_)
63766397 equation
6377- Debug.fprint(Flags.FAILTRACE, "- Inst.addClassdefsToEnv2 failed\n");
6398+ Debug.fprint(Flags.FAILTRACE, "- Inst.addClassdefToEnv2 failed\n");
63786399 then
63796400 fail();
63806401 end matchcontinue;
6381- end addClassdefsToEnv2 ;
6402+ end addClassdefToEnv2 ;
63826403
63836404protected function isStructuralParameter
63846405"function: isStructuralParameter
0 commit comments