@@ -422,7 +422,7 @@ algorithm
422422 then
423423 (cache,e_1,prop_1,st_1); */
424424 /* --------------------------------*/
425-
425+
426426 case (cache,env,Absyn . CALL (function_ = fn,functionArgs = Absyn . FUNCTIONARGS (args = args,argNames = nargs)),impl,st,doVect)
427427 local Exp . Exp e;
428428 equation
@@ -432,7 +432,36 @@ algorithm
432432 (cache,e_1,prop_1) = cevalIfConstant(cache,e, prop, c, impl, env);
433433 Debug . fprintln("sei" , "elab_exp CALL done" );
434434 then
435- (cache,e_1,prop_1,st_1);
435+ (cache,e_1,prop_1,st_1);
436+
437+ /* Array For iterator expression */
438+ case (cache,env,Absyn . CALL (function_ = Absyn . CREF_IDENT ("array" ,{}),functionArgs = Absyn . FOR_ITER_FARG (e1,rangeList)),impl,st,doVect)
439+ local Exp . Exp e;
440+ list< Absyn . Ident > idList;
441+ Absyn . Exp e1,vb;
442+ Absyn . ForIterators rangeList;
443+ Absyn . Algorithm absynStmt,temp;
444+ list< Absyn . Ident > idList;
445+ Absyn . ComponentRef c1,c2;
446+ list< Absyn . ElementItem > declList;
447+ list< Absyn . AlgorithmItem > vb_body;
448+ equation
449+ idList = Inst . extractLoopVars(rangeList,{});
450+
451+ // Create temporary array to store the result from the for-iterator construct
452+ (cache,declList) = Inst . createForIteratorArray(cache,env,e1,idList,rangeList,impl);
453+
454+ // Create for-statements
455+ temp = Inst . createForIteratorAlgorithm(e1,rangeList,idList,Absyn . CREF_IDENT ("VEC__" ,{}));
456+
457+ vb_body = Util . listCreate(Absyn . ALGORITHMITEM (temp,NONE ()));
458+ vb = Absyn . VALUEBLOCK (declList,Absyn . VALUEBLOCKALGORITHMS (vb_body),
459+ Absyn . CREF (Absyn . CREF_IDENT ("VEC__" ,{})));
460+
461+ (cache,e_1,prop_1,st_1) = elabExp(cache,env,vb,impl,st,doVect);
462+ then
463+ (cache,e_1,prop_1,st_1);
464+
436465 case (cache,env,Absyn . TUPLE (expressions = (e as (e1 :: rest))),impl,st,doVect) /* PR. Get the properties for each expression in the tuple.
437466 Each expression has its own constflag.
438467 !!The output from functions does just have one const flag.
@@ -571,9 +600,10 @@ algorithm
571600 b_alg_2 = Convert . fromAlgStatesToExpStates(b_alg,{});
572601 b_alg_dae = Exp . ALGORITHM (Exp . ALGORITHM2 (b_alg_2));
573602
574- (cache,res2,prop as Types . PROP (_,_),st) = elabExp(cache,env2,res,impl,st,doVect);
575-
576- then (cache,Exp . VALUEBLOCK (dae2,b_alg_dae,res2),prop,st);
603+ (cache,res2,prop as Types . PROP (tp,_),st) = elabExp(cache,env2,res,impl,st,doVect);
604+ tp_1 = Types . elabType(tp);
605+
606+ then (cache,Exp . VALUEBLOCK (tp_1,dae2,b_alg_dae,res2),prop,st);
577607
578608 // Equations must converted into Algorithm statements
579609 case (cache,env,Absyn . VALUEBLOCK (ld,Absyn . VALUEBLOCKEQUATIONS (
@@ -634,9 +664,10 @@ algorithm
634664
635665 b_alg_dae = Exp . ALGORITHM (Exp . ALGORITHM2 (b_alg_2));
636666
637- (cache,res2,prop as Types . PROP (_,_),st) = elabExp(cache,env2,res,impl,st,doVect);
638-
639- then (cache,Exp . VALUEBLOCK (dae2,b_alg_dae,res2),prop,st);
667+ (cache,res2,prop as Types . PROP (tp,_),st) = elabExp(cache,env2,res,impl,st,doVect);
668+ tp_1 = Types . elabType(tp);
669+
670+ then (cache,Exp . VALUEBLOCK (tp_1,dae2,b_alg_dae,res2),prop,st);
640671
641672 // -------------------------------------
642673 // Part of the MetaModelica extension. KS
0 commit comments