@@ -2130,9 +2130,13 @@ algorithm
21302130
21312131 (env1,ih) = InstUtil . addClassdefsToEnv(env, ih, pre, cdefelts, impl, SOME (mods)) "1. CLASS & IMPORT nodes and COMPONENT nodes(add to env)" ;
21322132 cdefelts_1 = InstUtil . addNomod(cdefelts) "instantiate CDEFS so redeclares are carried out" ;
2133- (cache,env2,ih,cdefelts_2) = updateCompeltsMods(cache,env1,ih, pre, cdefelts_1, ci_state, impl);
2134- // env2 = env1;
2135- // cdefelts_2 = cdefelts_1;
2133+ /*
2134+ (cache,env2,ih,cdefelts_2) =
2135+ updateCompeltsMods(cache, env1, ih, pre,
2136+ InstUtil.sortElementList(cdefelts_1, env1, Env.inFunctionScope(env1)),
2137+ ci_state, impl);*/
2138+ env2 = env1;
2139+ cdefelts_2 = cdefelts_1;
21362140
21372141 // (cache, cdefelts_2) = removeConditionalComponents(cache, env2, cdefelts_2, pre);
21382142 (cache,env3,ih,store,dae1,csets,ci_state1,tys,graph) =
@@ -2416,9 +2420,13 @@ algorithm
24162420 (cache,env3,ih) = InstUtil . addComponentsToEnv(cache, env2, ih, mods, pre, ci_state, compelts_1, compelts_1, eqs_1, inst_dims, impl);
24172421 // Update the modifiers of elements to typed ones, needed for modifiers
24182422 // on components that are inherited.
2419- (cache,env4,ih,compelts_2) = updateCompeltsMods(cache, env3, ih, pre, compelts_1, ci_state, impl);
2420- // compelts_2 = extcomps;
2421- // env4 = env3;
2423+ /*
2424+ (cache,env4,ih,compelts_2) =
2425+ updateCompeltsMods(cache, env3, ih, pre,
2426+ InstUtil.sortElementList(compelts_1, env3, Env.inFunctionScope(env3)),
2427+ ci_state, impl);*/
2428+ compelts_2 = compelts_1;
2429+ env4 = env3;
24222430
24232431 // compelts_1 = InstUtil.addNomod(compelts);
24242432 // cdefelts_1 = InstUtil.addNomod(cdefelts);
@@ -3191,7 +3199,10 @@ algorithm
31913199 lst_constantEls, lst_constantEls, {},
31923200 inst_dims, false ); // adrpo: here SHOULD BE IMPL=TRUE! not FALSE!
31933201
3194- (cache,env3,ih,lst_constantEls) = updateCompeltsMods(cache, env3, ih, pre, lst_constantEls, ci_state, true );
3202+ /* (cache,env3,ih,lst_constantEls) =
3203+ updateCompeltsMods(cache, env3, ih, pre,
3204+ InstUtil.sortElementList(lst_constantEls, env3, Env.inFunctionScope(env3)),
3205+ ci_state, true);*/
31953206
31963207 (cache,env3,ih,_,_,_,ci_state2,vars,_) =
31973208 instElementList(cache, env3, ih, UnitAbsyn . noStore, mods, pre, ci_state1, lst_constantEls,
@@ -3550,6 +3561,7 @@ algorithm
35503561 String comp_name;
35513562 UnitAbsyn . InstStore store;
35523563 list< DAE . Element > elts;
3564+ DAE . Mod daeMod;
35533565
35543566 // Don't instantiate conditional components with condition = false.
35553567 case (cache, env, ih, store, mod, pre, ci_state,
@@ -3569,10 +3581,11 @@ algorithm
35693581 then
35703582 (cache, env, ih, store, {}, csets, ci_state, {}, graph);
35713583
3572- /* most work done in inst_element. */
3584+ // most work done in inst_element.
35733585 case (cache,env,ih,store,mod,pre,ci_state,el,inst_dims,impl,callscope,graph, csets, _)
35743586 equation
35753587 ErrorExt . setCheckpoint("instElementList2" );
3588+ (cache,env,ih,{el}) = updateCompeltsMods(cache, env, ih, pre, {el}, ci_state, impl);
35763589 // Debug.fprintln(Flags.INST_TRACE, "INST ELEMENT: " +& Env.printEnvPathStr(env) +& " el: " +& SCodeDump.shortElementStr(Util.tuple21(el)) +& " mods: " +& Mod.printModStr(mod));
35773590 // check for duplicate modifications
35783591 ele = Util . tuple21(el);
@@ -4082,6 +4095,18 @@ algorithm
40824095
40834096 case (cache,env,ih,pre,{},_,_) then (cache,env,ih,{});
40844097
4098+ // Instantiate the element if there is no mod
4099+ case (cache,env,ih,pre,((elMod as (comp,DAE . NOMOD ())) :: xs),ci_state,impl)
4100+ equation
4101+ /*
4102+ name = SCode.elementName(comp);
4103+ cref = Absyn.CREF_IDENT(name,{});
4104+ (cache,env,ih) = updateComponentsInEnv(cache, env, ih, pre, DAE.NOMOD(), {cref}, ci_state, impl);
4105+ */
4106+ (cache,env,ih,res) = updateCompeltsMods_dispatch(cache, env, ih, pre, xs, ci_state, impl);
4107+ then
4108+ (cache,env,ih,elMod::res);
4109+
40854110 // Special case for components being redeclared, we might instantiate partial classes when instantiating var(-> instVar2->instClass) to update component in env.
40864111 case (cache,env,ih,pre,((comp,(cmod as DAE . REDECL (_,_,{(redComp,redMod)}))) :: xs),ci_state,impl)
40874112 equation
@@ -4107,13 +4132,6 @@ algorithm
41074132 then
41084133 (cache,env3,ih,((comp,cmod_1) :: res));
41094134
4110- // No need to update a mod unless there's actually anything there.
4111- case (cache,env,ih,pre,((elMod as (_,DAE . NOMOD ())) :: xs),ci_state,impl)
4112- equation
4113- (cache,env,ih,res) = updateCompeltsMods_dispatch(cache, env, ih, pre, xs, ci_state, impl);
4114- then
4115- (cache,env,ih,elMod::res);
4116-
41174135 // If the modifier has already been updated, just update the environment with it.
41184136 case (cache,env,ih,pre,((comp, cmod as DAE . MOD (subModLst = _)) :: xs),ci_state,impl)
41194137 equation
0 commit comments