Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add information about `each` and `final` to modifiers in the instance API.
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 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
135 changes: 135 additions & 0 deletions
135
testsuite/openmodelica/instance-API/GetModelInstanceMod2.mos
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,135 @@ | ||
// name: GetModelInstanceMod2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
loadString(" | ||
model A | ||
Real x; | ||
Real y; | ||
end A; | ||
|
||
model M | ||
A a1[2](final x = {2.0, 3.0}, each y = 1); | ||
A a2[3](x = {1.0, 2.0, 3.0}, each final y = 2); | ||
end M; | ||
"); | ||
|
||
getModelInstance(M, prettyPrint = true); | ||
|
||
// Result: | ||
// true | ||
// "{ | ||
// \"name\": \"M\", | ||
// \"restriction\": \"model\", | ||
// \"components\": [ | ||
// { | ||
// \"name\": \"a1\", | ||
// \"type\": { | ||
// \"name\": \"A\", | ||
// \"restriction\": \"model\", | ||
// \"components\": [ | ||
// { | ||
// \"name\": \"x\", | ||
// \"type\": \"Real\", | ||
// \"value\": { | ||
// \"binding\": [ | ||
// 2, | ||
// 3 | ||
// ] | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// }, | ||
// { | ||
// \"name\": \"y\", | ||
// \"type\": \"Real\", | ||
// \"value\": { | ||
// \"binding\": 1 | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// } | ||
// ] | ||
// }, | ||
// \"dims\": { | ||
// \"absyn\": [ | ||
// \"2\" | ||
// ], | ||
// \"typed\": [ | ||
// \"2\" | ||
// ] | ||
// }, | ||
// \"modifiers\": { | ||
// \"x\": { | ||
// \"final\": true, | ||
// \"$value\": \"{2.0, 3.0}\" | ||
// }, | ||
// \"y\": { | ||
// \"each\": true, | ||
// \"$value\": \"1\" | ||
// } | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// }, | ||
// { | ||
// \"name\": \"a2\", | ||
// \"type\": { | ||
// \"name\": \"A\", | ||
// \"restriction\": \"model\", | ||
// \"components\": [ | ||
// { | ||
// \"name\": \"x\", | ||
// \"type\": \"Real\", | ||
// \"value\": { | ||
// \"binding\": [ | ||
// 1, | ||
// 2, | ||
// 3 | ||
// ] | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// }, | ||
// { | ||
// \"name\": \"y\", | ||
// \"type\": \"Real\", | ||
// \"value\": { | ||
// \"binding\": 2 | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// } | ||
// ] | ||
// }, | ||
// \"dims\": { | ||
// \"absyn\": [ | ||
// \"3\" | ||
// ], | ||
// \"typed\": [ | ||
// \"3\" | ||
// ] | ||
// }, | ||
// \"modifiers\": { | ||
// \"x\": \"{1.0, 2.0, 3.0}\", | ||
// \"y\": { | ||
// \"final\": true, | ||
// \"each\": true, | ||
// \"$value\": \"2\" | ||
// } | ||
// }, | ||
// \"prefixes\": { | ||
// | ||
// } | ||
// } | ||
// ] | ||
// }" | ||
// 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