Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify for-statements more (#8117)
- Unroll for-statements where the iteration range consists of only one value (like `for i in 1:1 loop`). - Add Equation/Statement.replaceIteratorList to simplify the code.
- Loading branch information
Showing
8 changed files
with
68 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// name: ForStatement3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model ForStatement3 | ||
Real x[5]; | ||
algorithm | ||
for i in 2:2 loop | ||
x[i] := time; | ||
end for; | ||
end ForStatement3; | ||
|
||
// Result: | ||
// class ForStatement3 | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// Real x[4]; | ||
// Real x[5]; | ||
// algorithm | ||
// x[2] := time; | ||
// end ForStatement3; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters