Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix lookup so that it works also on iterators of complex type. - Improve Expression.replaceIterator so it handles qualified iterator names. - Improve construction of record array bindings in Ceval, evaluate each element instead of evaluating only one and filling an array. - Add simplification of record element expressions, to make sure mutable expressions are simplified away properly.
- Loading branch information
Showing
9 changed files
with
175 additions
and
31 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
27 changes: 27 additions & 0 deletions
27
testsuite/flattening/modelica/scodeinst/ArrayConstructorRecord1.mo
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,27 @@ | ||
// name: ArrayConstructorRecord1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
record R | ||
Real x; | ||
end R; | ||
|
||
model ArrayConstructorRecord1 | ||
parameter R r[3](x = {1, 2, 3}); | ||
Real x[:] = {i.x for i in r}; | ||
end ArrayConstructorRecord1; | ||
|
||
// Result: | ||
// class ArrayConstructorRecord1 | ||
// parameter Real r[1].x = 1.0; | ||
// parameter Real r[2].x = 2.0; | ||
// parameter Real r[3].x = 3.0; | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// equation | ||
// x = {1.0, 2.0, 3.0}; | ||
// end ArrayConstructorRecord1; | ||
// endResult |
27 changes: 27 additions & 0 deletions
27
testsuite/flattening/modelica/scodeinst/ArrayConstructorRecord2.mo
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,27 @@ | ||
// name: ArrayConstructorRecord2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
record R | ||
Real x = 1; | ||
end R; | ||
|
||
model ArrayConstructorRecord2 | ||
parameter R r[3]; | ||
Real x[:] = {i.x for i in r}; | ||
end ArrayConstructorRecord2; | ||
|
||
// Result: | ||
// class ArrayConstructorRecord2 | ||
// parameter Real r[1].x = 1.0; | ||
// parameter Real r[2].x = 1.0; | ||
// parameter Real r[3].x = 1.0; | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// equation | ||
// x = {1.0, 1.0, 1.0}; | ||
// end ArrayConstructorRecord2; | ||
// 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