@@ -2253,7 +2253,7 @@ algorithm
22532253end evaluateFunctions_updateStatement;
22542254
22552255
2256- protected function evaluateForStatement"evaluates a for statement. neste for loops wont work"
2256+ protected function evaluateForStatement"evaluates a for statement. nested for loops wont work"
22572257 input DAE . Statement stmtIn;
22582258 input DAE . FunctionTree funcTreeIn;
22592259 input BackendVarTransform . VariableReplacements replIn;
@@ -2277,8 +2277,9 @@ algorithm
22772277 (range,_) := BackendVarTransform . replaceExp(range,replIn,NONE ());
22782278 (start,stop,step) := getRangeBounds(range);
22792279 true := intEq(step,1 );
2280+ true := intGe(stop,start);
22802281 repl := replIn;
2281- for i in List . intRange2( start, stop) loop
2282+ for i in start: stop loop
22822283 repl := BackendVarTransform . addReplacement(repl, ComponentReference . makeCrefIdent(iter,DAE . T_INTEGER_DEFAULT ,{}),DAE . ICONST (i),NONE ());
22832284 (stmts,_,repl,_) := evaluateFunctions_updateStatement(stmtsIn,funcTreeIn,repl,i,{});
22842285
@@ -2302,8 +2303,7 @@ algorithm
23022303 lhsExps := List . unique(lhsExps);
23032304 lhsExpLst := List . map(lhsExps,Expression . getComplexContents); // consider arrays etc.
23042305 lhsExps := listAppend(List . flatten(lhsExpLst),lhsExps);
2305- lhsExps := List . filterOnTrue(lhsExps,Expression . isCref); // remove e.g. ASUBs and consider only the scalar subs
2306- outputs := List . map(lhsExps,Expression . expCref);
2306+ outputs := list(Expression . expCref(e) for e guard Expression . isCref(e) in lhsExps); // remove e.g. ASUBs and consider only the scalar subs
23072307 repl := replIn;
23082308 BackendVarTransform . removeReplacements(repl,outputs,NONE ());
23092309 stmtsOut := {stmtIn};
@@ -2321,9 +2321,10 @@ algorithm
23212321 (start, stop, step) := match(range)
23222322 local
23232323 Integer i1,i2,i3;
2324- case (DAE . RANGE (start= DAE . ICONST (i1),step= NONE (),stop= DAE . ICONST (i2)))
2324+ case (DAE . RANGE (start= DAE . ICONST (i1),step= NONE (),stop= DAE . ICONST (i2)))
2325+ equation
23252326 then (i1,i2,1 );
2326- case (DAE . RANGE (start= DAE . ICONST (i1),step= SOME (DAE . ICONST (i3)),stop= DAE . ICONST (i2)))
2327+ case (DAE . RANGE (start= DAE . ICONST (i1),step= SOME (DAE . ICONST (i3)),stop= DAE . ICONST (i2)))
23272328 then (i1,i2,i3);
23282329 else
23292330 equation
0 commit comments